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

    [Test]
    public async Task EditRole_WhenCalled_ReturnsOK()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;
        var editRole = new EditRole();

        //Act
        var actualResult = await _roleController.EditRole(editRole, cancellationToken);

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