Files

32 lines
1023 B
C#

namespace Febe.Tests.Desktop.Support;
/// <summary>Files of the repository the desktop tests look at (the committed icon, the NSIS script).</summary>
internal static class Repository
{
/// <summary>The folder with Febe.slnx, found from the test binaries upward; null outside a checkout.</summary>
public static string? Root()
{
for (var folder = new DirectoryInfo(AppContext.BaseDirectory); folder is not null; folder = folder.Parent)
{
if (File.Exists(Path.Combine(folder.FullName, "Febe.slnx")))
{
return folder.FullName;
}
}
return null;
}
/// <summary>A file of the repository; the test is inconclusive when the checkout is not there.</summary>
public static string PathOf(params string[] parts)
{
var root = Root();
if (root is null)
{
Assert.Inconclusive("Il repository non è accanto alle prove.");
}
return Path.Combine([root, .. parts]);
}
}