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 DeleteRoleAccessUnitTests : RoleControllerTestBase
{
    [SetUp]
    public override async Task Setup()
    {
        await base.Setup();
    }

    [Test]
    public async Task PostRoleAccess_WhenCalled_ReturnsOK()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;
        var access = new DeleteRoleSecurityAccess();

        //Act
        var actualResult = await _roleController.DeleteRoleAccess(access, cancellationToken);

        //Assert
        _roleManagerMock.Verify(x => x.DeleteRoleSecurityAccess(It.IsAny<AuditUserDetails>(), access, cancellationToken), Times.Once);
        Assert.That(actualResult.GetType(), Is.EqualTo(typeof(OkResult)));
    }
}