test: normalize project reference paths across platforms

This commit is contained in:
justme committed 2026-10-05 00:49:20 +08:00
1 parent faf1203f0a
commit ce3ba51c02
1 file changed
+4 -1
@@ -36,10 +36,13 @@ public sealed class ArchitectureTests
Path.GetFileNameWithoutExtension(path),
path,
Path.GetDirectoryName(path)!,
[.. items.Where(e => e.Name == "ProjectReference").Select(e => Path.GetFileNameWithoutExtension((string?)e.Attribute("Include") ?? ""))],
[.. items.Where(e => e.Name == "ProjectReference").Select(e => Path.GetFileNameWithoutExtension(NormalizePath((string?)e.Attribute("Include") ?? "")))],
[.. items.Where(e => e.Name == "PackageReference").Select(e => (string?)e.Attribute("Include") ?? "")]);
})];
private static string NormalizePath(string path) =>
path.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
private static bool IsTest(Project p) => p.Path.Contains(Path.DirectorySeparatorChar + "tests" + Path.DirectorySeparatorChar, StringComparison.Ordinal);
private static bool IsFleet(Project p) => p.Name.StartsWith("Fleet.", StringComparison.Ordinal) && !IsTest(p);