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)));
    }
}