using e_suite.Modules.MailTemplatesManager.UnitTests.Helpers;
using e_suite.Utilities.Pagination;
using eSuite.Core.MailService;
using NUnit.Framework;

namespace e_suite.Modules.MailTemplatesManager.UnitTests;

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

    [Test]
    public async Task GetMailTemplateTypes_WhenCalled_ReturnsListOfTypes()
    {
        //Arrange
        var paging = new Paging();

        //Act
        var results = await MailTemplateManager.GetMailTemplateTypes(paging, CancellationToken.None);

        //Assert
        Assert.That(results, Is.Not.Null);
        Assert.That(results.Count, Is.EqualTo(Enum.GetValues(typeof(MailType)).Length));

        Assert.That(results.Data, Is.Not.Null);
        Assert.That(results.Data.Count(), Is.EqualTo(results.Count));

        foreach (var item in results.Data)
        {
            Assert.That(item.MailType, Is.Not.Null);
            Assert.That(string.IsNullOrWhiteSpace(item.Description), Is.False);
        }
    }
}