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

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

    [Test]
    public async Task GetMailTemplateTypes_WhenCalled_ReturnsPagedData()
    {
        //Arrange
        var cancellationToken = CancellationToken.None;

        var mailTemplate = new PostMailTemplate();

        //Act
        var actualResult = await _mailTemplatesController.PostMailTemplate(mailTemplate, cancellationToken);

        //Assert
        _mailTemplateManagerMock.Verify(
            x => x.PostMailTemplate(mailTemplate, It.IsAny<AuditUserDetails>(), cancellationToken), Times.Once);

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