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 CreateSpecificationUnitTests : SpecificationControllerTestBase
{
    [SetUp]
    public override async Task Setup()
    {
        await base.Setup();
    }

    [Test]
    public async Task CreateSpecification_WhenCalled_ReturnsPagedData()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;
        var createSpecification = new CreateSpecification();

        //Act
        var actualResult = await _specificationController.CreateSpecification(createSpecification, cancellationToken);

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