namespace Khaemhat.Web.Tests.Hosting; /// /// The icons served by the app are copies of the official ones in assets/ (SPEC ยง16.6): they must not drift. /// [TestClass] public sealed class IconTests { [TestMethod] [DataRow("favicon.ico")] [DataRow("icon.svg")] [DataRow("icon-256.png")] [DataRow("icon-512.png")] public void ServedIcon_MatchesTheOfficialAsset(string file) { var root = FindRoot(); var official = File.ReadAllBytes(Path.Combine(root, "assets", file)); var served = File.ReadAllBytes(Path.Combine(root, "src", "Khaemhat.Web", "wwwroot", file)); CollectionAssert.AreEqual(official, served, $"wwwroot/{file} differs from assets/{file}: copy it again."); } private static string FindRoot() { var dir = new DirectoryInfo(AppContext.BaseDirectory); while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "Khaemhat.sln"))) { dir = dir.Parent; } return dir?.FullName ?? throw new InvalidOperationException("Repository root (Khaemhat.sln) not found."); } }