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

    [Test]
    public async Task AddRoleUser_WhenCalled_ReturnsOK()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;
        var userRoleIds = new UserRoleIds();

        //Act
        var actualResult = await _roleController.AddRoleUser(userRoleIds, cancellationToken);

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