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.SsoManagerControllerUnitTests;

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

    [Test]
    public async Task EditSsoProvider_WhenCalled_ReturnsOk()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;

        var ssoProvider = new EditSsoProvider();

        //Act
        var actualResult = await SsoManagerController.EditSsoProvider(ssoProvider, cancellationToken);

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