mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Move fixtures directory and clean up locator
This commit is contained in:
22
test/PathHelper.cs
Normal file
22
test/PathHelper.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user