using TeleWave.Domain.Broadcast;
using TeleWave.Domain.Settings;
using Xunit;

namespace TeleWave.Domain.Tests.Broadcast;

/// <summary>Мелкие фабрики/сеттеры простых сущностей, которые нигде не покрыты напрямую.</summary>
public class DomainRecordFactoryTests
{
    [Fact]
    public void BumperAsset_Create_StoresRenderedText()
    {
        var template = Guid.NewGuid();
        var variant = Guid.NewGuid();
        var poster = Guid.NewGuid();
        var asset = Guid.NewGuid();

        var b = BumperAsset.Create(template, variant, "sig", "[]", poster, asset);

        Assert.Equal(template, b.TemplateId);
        Assert.Equal(variant, b.VariantId);
        Assert.Equal("sig", b.Signature);
        Assert.Equal("[]", b.RenderedLinesJson);
        Assert.Equal(poster, b.PosterShowId);
        Assert.Equal(asset, b.MediaAssetId);
    }

    [Fact]
    public void AppSetting_CreateAndSetValue()
    {
        var s = AppSetting.Create("site.title", "TeleWave");
        Assert.Equal("site.title", s.Key);
        Assert.Equal("TeleWave", s.Value);

        s.SetValue("New");
        Assert.Equal("New", s.Value);
    }
}
