Added new BumperEndpoints to the API for managing bumper templates and variants, enhancing the channel management capabilities. Removed outdated bumper-related commands and handlers from the application, streamlining the codebase and improving maintainability. Updated ChannelEndpoints to reflect these changes and ensure proper routing for the new endpoints.
69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
using TeleWave.Application.Broadcast;
|
|
using TeleWave.Application.Broadcast.GetChannel;
|
|
using TeleWave.Application.Tests.Support;
|
|
using TeleWave.Domain.Broadcast;
|
|
using Xunit;
|
|
|
|
namespace TeleWave.Application.Tests.Broadcast;
|
|
|
|
/// <summary>
|
|
/// Карточка канала: только собственные свойства канала. Сетка, стыки и заставки сюда не входят —
|
|
/// они общие и запрашиваются отдельно.
|
|
/// </summary>
|
|
public class ChannelDetailsTests
|
|
{
|
|
private static readonly DateTimeOffset T0 = new(2026, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
|
|
|
[Fact]
|
|
public async Task GetChannel_MapsOwnSettings()
|
|
{
|
|
var fixture = new TestDb();
|
|
var channel = Channel.Create("Первый", "one", T0);
|
|
var fillerId = Guid.NewGuid();
|
|
var logoId = Guid.NewGuid();
|
|
channel.UpdateSettings("Первый", isEnabled: true, fillerId);
|
|
channel.UpdateTimeSettings(3, 120, new TimeOnly(5, 0));
|
|
channel.UpdateViewerSettings(logoId, LogoCorner.BottomLeft, 0.4, showClock: true, 0.25);
|
|
|
|
await using (var seed = fixture.New())
|
|
{
|
|
seed.Channels.Add(channel);
|
|
await seed.SaveChangesAsync(CancellationToken.None);
|
|
}
|
|
|
|
await using var db = fixture.New();
|
|
var result = await new GetChannelQueryHandler(db).Handle(
|
|
new GetChannelQuery(channel.Id),
|
|
CancellationToken.None
|
|
);
|
|
|
|
Assert.True(result.IsSuccess);
|
|
var dto = result.Value;
|
|
Assert.Equal("one", dto.Slug);
|
|
Assert.True(dto.IsEnabled);
|
|
Assert.Equal(3, dto.Number);
|
|
Assert.Equal(120, dto.UtcOffsetMinutes);
|
|
Assert.Equal(new TimeOnly(5, 0), dto.DayStartTime);
|
|
Assert.Equal(fillerId, dto.FillerAssetId);
|
|
Assert.Equal(logoId, dto.Viewer.LogoImageId);
|
|
Assert.Equal(LogoCorner.BottomLeft, dto.Viewer.LogoCorner);
|
|
Assert.Equal(0.4, dto.Viewer.LogoOpacity);
|
|
Assert.True(dto.Viewer.ShowClock);
|
|
Assert.Equal(0.25, dto.Viewer.AnalogFilterStrength);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task GetChannel_UnknownId_ReturnsNotFound()
|
|
{
|
|
var fixture = new TestDb();
|
|
await using var db = fixture.New();
|
|
|
|
var result = await new GetChannelQueryHandler(db).Handle(
|
|
new GetChannelQuery(Guid.NewGuid()),
|
|
CancellationToken.None
|
|
);
|
|
|
|
Assert.Equal(ChannelErrors.NotFound, result.Error);
|
|
}
|
|
}
|