public ITestContext GetContext(string category, string testName) { TestDefinition testData = testDataProvider.GetCategoryTest(category, testName); if (testData == null) { throw new InvalidOperationException($"Unable to execute test {testName} for {category} as there was no defined test data"); } string testFolder = !string.IsNullOrEmpty(testData?.SourceFolder) ? testData.SourceFolder : testName; string testFilesPath = Path.Combine(rootDirectory, category, testFolder); List <FileInfo> sourceFiles = GetSourceFiles(testData, testFilesPath); List <FileInfo> referenceFiles = GetReferenceFiles(testData, testFilesPath); List <FileInfo> resourceFiles = GetResourceFiles(testData, testFilesPath); FileInfo comparisonFile = GetComparisonFile(testData, testFilesPath); FileInfo commentFile = GetCommentFile(testData, testFilesPath); return(new TestContext { SourceFiles = sourceFiles.ToArray(), Defines = testData.Defines, References = referenceFiles.ToArray(), ExpectedOutput = comparisonFile, CommentFile = commentFile, StreamSourceResolver = new LocalTestContextStreamResolver(new DirectoryInfo(testFilesPath)), Resources = resourceFiles.ToArray(), CompilationOptions = testData.Options.Adapt <TestContextCompliationOptions>() }); }