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

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

    [Test]
    public async Task EditSpecification_WhenCalled_ReturnsPagedData()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;
        var editSpecification = new EditSpecification();

        //Act
        var actualResult = await _specificationController.EditSpecification(editSpecification, cancellationToken);

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