using e_suite.Database.Audit;
using eSuite.Core.Miscellaneous;
using Microsoft.AspNetCore.Mvc;
using Moq;
using NUnit.Framework;

namespace eSuite.API.UnitTests.Controllers.RoleControllerUnitTests;

[TestFixture]
public class DeleteRoleUnitTests : RoleControllerTestBase
{
    [SetUp]
    public override async Task Setup()
    {
        await base.Setup();
    }

    [Test]
    public async Task DeleteRole_WhenCalled_ReturnsOK()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;
        var deleteRole = new GeneralIdRef();

        //Act
        var actualResult = await _roleController.DeleteRole(deleteRole, cancellationToken);

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