// ----------------------------------------------------------------------------- // ReachabilityTestFixture.cs // Sprint: SPRINT_3500_0004_0003_integration_tests_corpus // Task: T2 - Reachability Integration Tests // Description: Test fixture for reachability integration tests // ----------------------------------------------------------------------------- using System.Reflection; namespace StellaOps.Integration.Reachability; /// /// Test fixture for reachability integration tests. /// Provides access to corpus fixtures and test data. /// public sealed class ReachabilityTestFixture { private readonly string _corpusBasePath; private readonly string _fixturesBasePath; public ReachabilityTestFixture() { var assemblyLocation = Assembly.GetExecutingAssembly().Location; var assemblyDirectory = Path.GetDirectoryName(assemblyLocation)!; _corpusBasePath = Path.Combine(assemblyDirectory, "corpus"); _fixturesBasePath = Path.Combine(assemblyDirectory, "fixtures"); } /// /// Gets the path to a language-specific corpus directory. /// /// Language identifier (dotnet, java, python, etc.) /// Full path to the corpus directory public string GetCorpusPath(string language) { var corpusPath = Path.Combine(_corpusBasePath, language); if (!Directory.Exists(corpusPath)) { throw new DirectoryNotFoundException( $"Corpus directory not found for language '{language}' at: {corpusPath}"); } return corpusPath; } /// /// Gets the path to a specific fixture directory. /// /// Name of the fixture /// Full path to the fixture directory public string GetFixturePath(string fixtureName) { var fixturePath = Path.Combine(_fixturesBasePath, fixtureName); if (!Directory.Exists(fixturePath)) { throw new DirectoryNotFoundException( $"Fixture directory not found: {fixturePath}"); } return fixturePath; } /// /// Lists all available corpus languages. /// public IReadOnlyList GetAvailableCorpusLanguages() { if (!Directory.Exists(_corpusBasePath)) { return Array.Empty(); } return Directory.GetDirectories(_corpusBasePath) .Select(Path.GetFileName) .Where(name => !string.IsNullOrEmpty(name)) .Cast() .ToList(); } /// /// Checks if a corpus exists for the given language. /// public bool HasCorpus(string language) { var corpusPath = Path.Combine(_corpusBasePath, language); return Directory.Exists(corpusPath); } }