test(385): cover override-driven per-channel failure isolation
Build ErsatzTV Image / CI image pin matches docker/ci (pull_request) Successful in 6s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 6s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 6s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 8m33s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 1m4s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 13m57s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 11m58s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 18m58s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped

Adds the one coverage case the cold review flagged (LOW): a two-channel batch
where the first channel's advanced override is rejected downstream and the
second, override-free channel is still Created — directly exercising the
partial-success / batch-independence guarantee for the new override path.
Test-only; no behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-17 23:33:10 +02:00
co-authored by Claude Opus 4.8
parent 8f61ad6530
commit b9ab2d79f3
@@ -160,6 +160,40 @@ public class CreateAutoTunedChannelsHandlerTests
Arg.Any<CancellationToken>());
}
[Test]
public async Task A_Bad_Per_Channel_Override_Fails_Only_That_Channel_Not_The_Batch()
{
// First channel's override is rejected downstream (e.g. a non-existent FFmpegProfileId);
// the second, override-free channel must still be Created. Keyed on channel number so the
// two CreateChannelFromLineup sends resolve to different outcomes.
_mediator.Send(
Arg.Is<CreateChannelFromLineup>(c => c.Number == "500"),
Arg.Any<CancellationToken>())
.Returns((Either<BaseError, CreateChannelFromLineupResponseModel>)
BaseError.New("FFmpegProfile 999 does not exist."));
_mediator.Send(
Arg.Is<CreateChannelFromLineup>(c => c.Number == "501"),
Arg.Any<CancellationToken>())
.Returns((Either<BaseError, CreateChannelFromLineupResponseModel>)
new CreateChannelFromLineupResponseModel(88, null, 1, 2));
var result = await Handle(new CreateAutoTunedChannels(
TemplateId: 3, Group: "Auto-Tuned",
new List<AutoTuneChannelSelection>
{
new(
AutoTuneAxis.TvGenre, "Comedy", "Bad", "500",
Advanced: new CreateChannelFromLineupAdvancedOptions(FFmpegProfileId: 999)),
new(AutoTuneAxis.TvGenre, "Drama", "Good", "501")
}));
result.FailedCount.ShouldBe(1);
result.CreatedCount.ShouldBe(1);
result.Results[0].Status.ShouldBe(AutoTuneOutcomeStatus.Failed);
result.Results[1].Status.ShouldBe(AutoTuneOutcomeStatus.Created);
result.Results[1].ChannelId.ShouldBe(88);
}
[Test]
public async Task Number_Collision_Is_Skipped_Not_Failed()
{