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

namespace eSuite.API.UnitTests.Controllers.GlossariesManagerControllerUnitTests;

[TestFixture]
public class DeleteUnitTests : GlossariesManagerControllerTestBase
{
    [SetUp]
    public override async Task Setup()
    {
        await base.Setup();


    }

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

        var cancellationToken = CancellationToken.None;

        //Act
        var actualResult = await _glossariesController.Delete(glossaryItem, cancellationToken);

        //Assert
        _glossariesManagerMock.Verify(x => x.DeleteGlossaryItem(It.IsAny<AuditUserDetails>(), glossaryItem, cancellationToken), Times.Once);

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