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

namespace eSuite.API.UnitTests.Controllers.SpecificationControllerUnitTests;

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

    [Test]
    public async Task DeleteSpecification_WhenCalled_ReturnsPagedData()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;
        var generalIdRef = new GeneralIdRef();

        //Act
        var actualResult = await _specificationController.DeleteSpecification(generalIdRef, cancellationToken);

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