Update README.md with additional SonarCloud badges and improve CI workflow for coverage reporting
Enhanced the README.md file by adding new SonarCloud badges for coverage, bugs, code smells, security rating, and maintainability rating. Updated the CI workflow to remove coverage collection from the test step, as it is now handled by SonarCloud, streamlining the process and ensuring accurate badge representation.
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
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_MapsSettingsAndBumperTemplates()
|
||||
{
|
||||
var fixture = new TestDb();
|
||||
var channel = Channel.Create("Первый", "one", T0);
|
||||
var fillerId = Guid.NewGuid();
|
||||
var logoId = Guid.NewGuid();
|
||||
channel.UpdateSettings("Первый", isEnabled: true, bumpersEnabled: true, fillerId);
|
||||
channel.UpdateTimeSettings(3, 120, new TimeOnly(5, 0));
|
||||
channel.UpdateBumperSettings(BumperFont.Serif, BumperSelection.Random);
|
||||
channel.UpdateViewerSettings(logoId, LogoCorner.BottomLeft, 0.4, showClock: true, 0.25);
|
||||
// Второй блок должен приехать после дефолтного — порядок задаёт позиция.
|
||||
var extra = channel.AddBumperTemplate("Ночной");
|
||||
|
||||
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.True(dto.BumpersEnabled);
|
||||
Assert.Equal(BumperFont.Serif, dto.Bumper.Font);
|
||||
Assert.Equal(BumperSelection.Random, dto.Bumper.Selection);
|
||||
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);
|
||||
|
||||
Assert.Equal(2, dto.BumperTemplates.Count);
|
||||
Assert.True(dto.BumperTemplates[0].IsDefault);
|
||||
Assert.Equal(extra.Id, dto.BumperTemplates[1].Id);
|
||||
Assert.Equal("Ночной", dto.BumperTemplates[1].Name);
|
||||
// Своего звука у свежего блока нет — джингл синтезируется.
|
||||
Assert.False(dto.BumperTemplates[1].HasAudio);
|
||||
Assert.NotEmpty(dto.BumperTemplates[0].Variants);
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user