using e_suite.API.Common.models;
using eSuite.Core.Miscellaneous;
using NUnit.Framework;

namespace e_suite.API.Common.UnitTests;

[TestFixture]
public class CustomFieldValueExtensionsUnitTests
{
    [Test]
    public void test()
    {
        //Arrange
        var values = new List<CustomFieldValues>();
        values.Add(new CustomFieldValues
        {
            Id = new GeneralIdRef
            {
                Id = 666,
                Guid = new Guid("c8564cb3-9d42-4a56-8b0d-df1792cd6c4a")
            },
            Values = new List<CustomFieldValue>
            {
                new()
                {
                    Value = "Hello",
                    DisplayValue = "Hello Display"
                }
            }
        });

        //Act
        var results = values.ToCustomFieldsValues();

        //Assert
        Assert.That(results.Count, Is.EqualTo(1));
        Assert.That(results[0].Id.Id, Is.EqualTo(666));
        Assert.That(results[0].Id.Guid, Is.EqualTo(new Guid("c8564cb3-9d42-4a56-8b0d-df1792cd6c4a")));
        Assert.That(results[0].Values.Count, Is.EqualTo(1));
        Assert.That(results[0].Values[0].Value, Is.EqualTo("Hello"));
        Assert.That(results[0].Values[0].DisplayValue, Is.EqualTo("Hello Display"));
    }
}