namespace RioJoy.Core.Tests;

/// <summary>Locates committed reference assets relative to the repo root.</summary>
internal static class TestRepo
{
    public static string Root()
    {
        DirectoryInfo? dir = new(AppContext.BaseDirectory);
        while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "RioJoy.sln")))
            dir = dir.Parent;
        return dir?.FullName ?? throw new DirectoryNotFoundException("Could not locate repo root (RioJoy.sln).");
    }

    public static string CustomBackground(string file) =>
        Path.Combine(Root(), "docs", "reference", "customBackground", file);
}
