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

namespace eSuite.API.UnitTests.Controllers.DomainControllerUnitTests;

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

    [Test]
    public async Task EditDomain_WhenCalled_ReturnsOKResult()
    {
        //Arrange
        var generalIdRef = new GeneralIdRef();

        var cancellationToken = CancellationToken.None;

        //Act
        var actualResult = await _domainController.DeleteDomain(generalIdRef, cancellationToken);

        //Assert
        _domainManagerMock.Verify(x => x.DeleteDomainAsync(It.IsAny<AuditUserDetails>(), generalIdRef, cancellationToken), Times.Once);

        Assert.That(actualResult.GetType(), Is.EqualTo(typeof(OkResult)));
    }
}