using System; using System.IO; using Microsoft.Extensions.Logging; namespace AcDream.Content.Tests; /// /// Dat-dir resolution for the Content.Tests dat-gated equivalence suite. /// Mirrors the exact pattern used by /// tests/AcDream.Core.Tests/Conformance/ConformanceDats.ResolveDatDir and /// tests/AcDream.Core.Tests/Conformance/DatConcurrencyStressTests /// ("dats absent (CI) -- skip, matching suite convention"). Content.Tests /// cannot reference AcDream.Core.Tests (a test project, not a library), so /// this is a deliberate small duplication of the resolution logic — not a /// new convention. /// public static class ContentConformanceDats { public static string? ResolveDatDir() { var fromEnv = Environment.GetEnvironmentVariable("ACDREAM_DAT_DIR"); if (!string.IsNullOrWhiteSpace(fromEnv) && Directory.Exists(fromEnv)) return fromEnv; var def = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Documents", "Asheron's Call"); return Directory.Exists(def) ? def : null; } } /// Minimal ILogger writing to Console — surfaces MeshExtractor failures during the equivalence sweep instead of silently swallowing them (NullLogger would hide the exact failure this suite exists to catch). internal sealed class TestConsoleLogger : ILogger { public IDisposable? BeginScope(TState state) where TState : notnull => null; public bool IsEnabled(LogLevel logLevel) => logLevel >= LogLevel.Warning; public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) { if (!IsEnabled(logLevel)) return; Console.WriteLine($"[{logLevel}] MeshExtractor: {formatter(state, exception)}"); if (exception is not null) Console.WriteLine(exception); } }