Files
LlamaCasty/ytLive.Tests/RecordingFileTests.cs
T
gramps a9eb360288 TASK 18: local (record-only) recording pipeline + top-bar pills/light/Start-End button UX
Encoder dual-output: StreamEnabled/RecordEnabled/RecordPath options; per-output
ffmpeg block (stream ->flv, record ->mp4); throw unless at least one output.

RecordingFile: auto-name ty-<yyyymmdd>-<start hhmm>-0000.mp4, rename-on-stop to
ty-...-<len hhmmss>.mp4 with numeric-suffix on collision. LayoutStore persists
record folder. MainViewModel: REC/ON-AIR pills, status light, single Start<->End
button (replaces Start/Stop variants), StopStream no longer signs out, explicit
session timer. About overlay widened. Sign In label + spacing before Start.

Tests: 244 passed / 246 (2 pre-existing: AudioPipeline gains-mute, RoundClip).
Build 0 warnings. Scope check clean.

Memory-map correction (derived-solution rule, 2026-08-29): image-shrink recipe was
never recorded when first done, so it was re-derived. Added Derived-solution/recipes
rule to AGENTS.md; MyMistakes.md now a permanent recipes registry (records the
verified WPF-imaging shrink recipe); schema.md rows MyMistakes as registry; ai.md
points to the rule. README hero image replaced: 3.2MB screenshot -> 1400x794 ->
188KB docs/ytLlive-preview.jpg (JPEG q82).
2026-08-29 09:02:55 -07:00

50 lines
1.6 KiB
C#

using Xunit;
using ytLive.Services;
namespace ytLive.Tests;
/// <summary>
/// Local recording filename rules (TASK 18): <c>ty-&lt;yyyyMMdd&gt;-&lt;HHmm start&gt;-&lt;hh2mm2 length&gt;.mp4</c>.
/// Recordings start with a <c>0000</c> length placeholder and are renamed on stop.
/// </summary>
public class RecordingFileTests
{
[Fact]
public void BuildStartName_UsesDateHourAndMinute_WithZeroLength()
{
var start = new DateTime(2026, 8, 29, 14, 5, 0);
Assert.Equal("ty-20260829-1405-0000", RecordingFile.BuildStartName(start));
}
[Fact]
public void BuildStartName_PadsSingleDigitHourAndMinute()
{
var start = new DateTime(2026, 1, 2, 9, 7, 0);
Assert.Equal("ty-20260102-0907-0000", RecordingFile.BuildStartName(start));
}
[Fact]
public void BuildFinalName_ShortRecording_IsHhmmOfLength()
{
var start = new DateTime(2026, 8, 29, 14, 5, 0);
var length = TimeSpan.FromMinutes(2);
Assert.Equal("ty-20260829-1405-0002", RecordingFile.BuildFinalName(start, length));
}
[Fact]
public void BuildFinalName_HourAndMinutes_ConcatenatesHh2Mm2()
{
var start = new DateTime(2026, 8, 29, 14, 5, 0);
var length = new TimeSpan(1, 15, 0); // 1h 15m
Assert.Equal("ty-20260829-1405-0115", RecordingFile.BuildFinalName(start, length));
}
[Fact]
public void BuildFinalName_OverFlowHours_ShowsTotalHours()
{
var start = new DateTime(2026, 8, 29, 14, 5, 0);
var length = new TimeSpan(12, 30, 0); // 12h 30m
Assert.Equal("ty-20260829-1405-1230", RecordingFile.BuildFinalName(start, length));
}
}