namespace Febe.Tests.Desktop.Support;
/// Files of the repository the desktop tests look at (the committed icon, the NSIS script).
internal static class Repository
{
/// The folder with Febe.slnx, found from the test binaries upward; null outside a checkout.
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;
}
/// A file of the repository; the test is inconclusive when the checkout is not there.
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]);
}
}