using System.Text.RegularExpressions; using Avalonia.Media; using Xunit; namespace ClaudeDo.Ui.Tests; public class AccentPresetsTests { [Fact] public void EveryPreset_DefinesEverySwatch_AsAValidHex() { foreach (var preset in AccentPresets.All) { Assert.Equal(AccentPresets.SwatchCount, preset.Swatches.Length); foreach (var hex in preset.Swatches) Assert.True(Color.TryParse(hex, out _), $"{preset.Name}: '{hex}'"); } } [Fact] public void Tokens_DeclareEverySwatchBrush() { var dir = AppContext.BaseDirectory; while (dir is not null && !File.Exists(Path.Combine(dir, "src", "ClaudeDo.Ui", "Design", "Tokens.axaml"))) dir = Path.GetDirectoryName(dir); var tokens = File.ReadAllText(Path.Combine(dir!, "src", "ClaudeDo.Ui", "Design", "Tokens.axaml")); foreach (var key in AccentPresets.SwatchKeys) Assert.Matches(new Regex($"x:Key=\"{key}Brush\""), tokens); } }