using Vanguard.Content; using Vanguard.Rules.Cards; namespace Vanguard.Rules.Tests; /// Общий каталог для тестов: грузится один раз из content/sets. public static class TestCatalog { private static readonly Lazy LazyCatalog = new(Load, isThreadSafe: true); public static CardCatalog Instance => LazyCatalog.Value; private static CardCatalog Load() { var dir = new DirectoryInfo(AppContext.BaseDirectory); while (dir is not null && !Directory.Exists(Path.Combine(dir.FullName, "content", "sets"))) dir = dir.Parent; if (dir is null) throw new InvalidOperationException("Не найден каталог content/sets."); return CatalogLoader.LoadDirectory(Path.Combine(dir.FullName, "content", "sets")); } }