using System.IO;
namespace Rozpisky.Tests;
/// Cesty k testovacím datům (loga DXF dodávaná s programem).
public static class TestData
{
/// Kořen repozitáře – nalezen od bin složky testů směrem nahoru podle Rozpisky.sln.
public static string RepoRoot { get; } = NajdiKoren();
/// Plná cesta k logu ve zdrojové složce Rozpisky\Podklady\loga.
public static string Logo(string fileName) => Path.Combine(RepoRoot, "Rozpisky", "Podklady", "loga", fileName);
/// Všech 9 log dodávaných s programem.
public static readonly string[] VsechnaLoga =
{
"eu_op_doprava.dxf", "md_sfdi.dxf", "sprava_zeleznic.dxf", "exprojekt.dxf",
"signalprojekt.dxf", "tesia.dxf", "mco.dxf", "exprojekt+mco.dxf", "sudopBrno.dxf",
};
private static string NajdiKoren()
{
var dir = new DirectoryInfo(AppContext.BaseDirectory);
while (dir is not null)
{
if (File.Exists(Path.Combine(dir.FullName, "Rozpisky.sln"))) return dir.FullName;
dir = dir.Parent!;
}
throw new InvalidOperationException("Rozpisky.sln nenalezen nad " + AppContext.BaseDirectory);
}
}