using Shouldly; namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests; /// /// Reads an AdminUI source file for a source-scan pin alongside rendered component tests. /// Source scans prove wiring exists; actual browser checks cover native behavior. /// internal static class AdminUiSource { /// Reads a file under src/Server/ZB.MOM.WW.OtOpcUa.AdminUI. /// Path segments below the AdminUI project directory. /// The file text. public static string Read(params string[] relativeSegments) { var dir = new DirectoryInfo(Path.GetDirectoryName(SourceFile())!); while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "ZB.MOM.WW.OtOpcUa.slnx"))) dir = dir.Parent; dir.ShouldNotBeNull("could not locate the repository root (no ZB.MOM.WW.OtOpcUa.slnx above the test source)"); var parts = new[] { dir!.FullName, "src", "Server", "ZB.MOM.WW.OtOpcUa.AdminUI" }.Concat(relativeSegments).ToArray(); return File.ReadAllText(Path.Combine(parts)); } private static string SourceFile([System.Runtime.CompilerServices.CallerFilePath] string sourceFile = "") => sourceFile; }