Files
monorepo/LCU.API.Operations.IncentiveAPI/LCU.API.Internal.Operations.IncentiveApi.UnitTests/Controllers/SettingsControllerTest.cs
T
2026-03-17 09:53:09 -05:00

67 lines
2.2 KiB
C#

using System.Collections.Generic;
using System.Threading.Tasks;
using LCU.API.Internal.Operations.IncentiveApi.Services;
using LCU.Library.Internal.IncentiveApiModels.Entities;
using Microsoft.AspNetCore.Mvc;
using Moq;
using NUnit.Framework;
using LCU.API.Internal.Operations.IncentiveApi.Controllers;
using LCU.API.Internal.Operations.IncentiveApiLib.Persistence;
using LCU.API.Internal.Operations.IncentiveApiLib.Services;
namespace Application.UnitTests.Controllers
{
public class SettingsControllerTest
{
private SettingsController _controller;
private Mock<ICurrentUserService> _mockCurrentUserService;
private Mock<IDepartmentService> _mockDepartmentService;
private Mock<ISettingsService> _mockSettingsService;
private Mock<IUserService> _mockUserService;
[SetUp]
public void Setup()
{
_mockCurrentUserService = new Mock<ICurrentUserService>();
_mockDepartmentService = new Mock<IDepartmentService>();
_mockSettingsService = new Mock<ISettingsService>();
_mockUserService = new Mock<IUserService>();
_controller = new SettingsController(
_mockCurrentUserService.Object,
new DateTimeService(),
_mockDepartmentService.Object,
_mockSettingsService.Object,
_mockUserService.Object
);
}
[Test]
public async Task Get_OK()
{
_mockDepartmentService.Setup(service => service.GetAllDepartmentsAsync()).ReturnsAsync(
new List<Department>()
{
new Department()
{
Id = 0
}
});
_mockUserService.Setup(service => service.GetAllUserSummariesAsync()).ReturnsAsync(
new List<UserSummary>()
{
new UserSummary()
{
}
});
var result = await _controller.Get();
Assert.NotNull(result);
var okResult = result as OkObjectResult;
Assert.NotNull(okResult);
Assert.AreEqual(200, okResult.StatusCode);
}
}
}