Backend/e-suite.API/eSuite.API.UnitTests/Controllers/RoleControllerUnitTests/CreateRoleUnitTests.cs
2026-01-20 21:50:10 +00:00

32 lines
921 B
C#

using e_suite.API.Common.models;
using e_suite.Database.Audit;
using Microsoft.AspNetCore.Mvc;
using Moq;
using NUnit.Framework;
namespace eSuite.API.UnitTests.Controllers.RoleControllerUnitTests;
[TestFixture]
public class CreateRoleUnitTests : RoleControllerTestBase
{
[SetUp]
public override async Task Setup()
{
await base.Setup();
}
[Test]
public async Task CreateRole_WhenCalled_ReturnsOK()
{
//Arrange
var cancellationToken = CancellationToken.None;
var createRole = new CreateRole();
//Act
var actualResult = await _roleController.CreateRole(createRole, cancellationToken);
//Assert
_roleManagerMock.Verify(x => x.CreateRole(It.IsAny<AuditUserDetails>(), createRole, cancellationToken), Times.Once);
Assert.That(actualResult.GetType(), Is.EqualTo(typeof(OkResult)));
}
}