using OF_DL.Models.Dtos.Subscriptions;
using OF_DL.Models.Entities.Subscriptions;
using OF_DL.Models.Mappers;

namespace OF_DL.Tests.Models.Mappers;

public class SubscriptionsMapperTests
{
    [Fact]
    public void FromDto_ReturnsDefaults_WhenDtoNull()
    {
        Subscriptions result = SubscriptionsMapper.FromDto(null);

        Assert.False(result.HasMore);
        Assert.Empty(result.List);
    }

    [Fact]
    public void FromDto_MapsListItems()
    {
        SubscriptionsDto dto = new()
        {
            HasMore = true, List = [new ListItemDto { Id = 55, Username = null, IsRestricted = true }]
        };

        Subscriptions result = SubscriptionsMapper.FromDto(dto);

        Assert.True(result.HasMore);
        Assert.Single(result.List);
        Assert.Equal(55, result.List[0].Id);
        Assert.Equal(string.Empty, result.List[0].Username);
        Assert.True(result.List[0].IsRestricted);
    }
}
