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

namespace eSuite.API.UnitTests.Controllers.SsoManagerControllerUnitTests;

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

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

        var generalIdRef = new GeneralIdRef();

        //Act
        var actualResult = await SsoManagerController.DeleteSsoProvider(generalIdRef, cancellationToken);

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