using System; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using Xunit; using ytLive.Helpers; namespace ytLive.Tests; /// /// Build attribution (2026-09-04, after takes 3–6 could not be pinned to a binary): /// every build stamps a fresh GUID (ytLive.csproj GenerateBuildStamp), shown as the /// wordmark superscript and logged at startup. The unit pins the stamp shape; the /// RealApp test proves the wordmark ACTUALLY displays it (XAML wiring, live visual /// tree) — a stamp nobody can see would not have ended the guessing. /// public sealed class BuildStampTests { [Fact] public void Stamp_IsAFreshHexIdAndParsableTimestamp() { Assert.Matches(new Regex("^[0-9a-f]{8}$"), BuildStamp.Id); Assert.True(DateTime.TryParseExact(BuildStamp.BuiltLocal, "yyyy-MM-dd HH:mm:ss", null, System.Globalization.DateTimeStyles.None, out var built)); Assert.True(built <= DateTime.Now); Assert.True(built.Date >= new DateTime(2026, 9, 4)); } } [Collection("RealApp")] public sealed class BuildStampDisplayTests { private readonly RealAppHost _app; public BuildStampDisplayTests(RealAppHost app) => _app = app; [Fact] public void Wordmark_Shows_The_Build_Stamp_As_Superscript() { _app.Run(() => { var window = new MainWindow(); try { // TopBar is its own namescope (UserControl) — FindName from the // control, never from the window (MyMistakes: namescoped FindName). var topBar = (UserControl)window.FindName("TopBar")!; var stamp = (Run)topBar.FindName("BuildIdStamp")!; Assert.Equal(BuildStamp.Id, stamp.Text); Assert.Equal(BaselineAlignment.Superscript, stamp.BaselineAlignment); } finally { window.Close(); } }); } }