using e_suite.Utilities.Pagination;

namespace e_suite.Modules.CustomFieldManagerUnitTests.CustomFieldManagerUnitTests;

public class GetFieldsAsyncUnitTests : CustomFieldsTestBase<object>
{
    [SetUp]
    public override async Task Setup() => await base.Setup();

    [Test]
    public async Task GetSequences_Called_ReturnsSequenceList()
    {
        // Arrange
        var custFieldInDb = new CustomField
        {
            DefaultValue = "test",
            FieldType = eSuite.Core.CustomFields.FieldType.Time,
            Name = "NameExists",
            Id = 10
        };

        var customField = new CustomField
        {
            DefaultValue = "testOne",
            FieldType = eSuite.Core.CustomFields.FieldType.Text,
            Name = "TestOrg",
            Id = 15
        };
        _fakeCustomFieldRepository.CustomFields.Add(custFieldInDb);
        _fakeCustomFieldRepository.CustomFields.Add(customField);

        var paging = new Paging();

        // Act
        var result = await _customFieldManager.GetFieldsAsync(paging, default);

        // Assert
        Assert.That(result, Is.Not.Null);
        Assert.That(result.Count, Is.EqualTo(2));
    }
}