Move fixtures directory and clean up locator

This commit is contained in:
Caelan Sayler
2023-12-30 15:26:53 +00:00
parent 1e08addb52
commit a69bdd5e88
157 changed files with 36 additions and 89528 deletions

22
test/PathHelper.cs Normal file
View File

@@ -0,0 +1,22 @@
using System.Diagnostics;
public static class PathHelper
{
public static string GetFixturesDir()
=> Path.Combine(GetTestRoot(), "fixtures");
public static string GetFixture(params string[] names)
=> Path.Combine(new string[] { GetTestRoot(), "fixtures" }.Concat(names).ToArray());
public static string GetTestRoot()
{
// XXX: This is an evil hack, but it's okay for a unit test
// We can't use Assembly.Location because unit test runners love
// to move stuff to temp directories
var st = new StackFrame(true);
#pragma warning disable CS8604 // Possible null reference argument.
var di = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(st.GetFileName())));
#pragma warning restore CS8604 // Possible null reference argument.
return di.FullName;
}
}