private static Dictionary <string, KnownIssue> GetKnownIssues(Versions version, Languages language, IssueType issueType)
    {
        var lang           = language.AsString();
        var testNameSuffix = $"{lang}-{version}-{issueType.Suffix()}";

        return((issueType switch
        {
            IssueType.Execution => CSharpKnownIssues.GetCSharpExecutionKnownIssues(version),
            IssueType.Compilation => KnownIssues.GetCompilationKnownIssues(language, version),
            _ => throw new ArgumentException($"Unknown issue type: {issueType}")
        }).Where(kv => kv.Key.EndsWith(testNameSuffix)).ToDictionary(kv => kv.Key, kv => kv.Value));
Example #2
0
    private static IEnumerable <LanguageTestData> GetLanguageTestData(RunSettings runSettings)
    {
        if (runSettings == null)
        {
            throw new ArgumentNullException(nameof(runSettings));
        }

        var language               = runSettings.Language;
        var version                = runSettings.Version;
        var documentationLinks     = GetDocumentationLinks(version, language);
        var compilationKnownIssues = KnownIssues.GetCompilationKnownIssues(language, version);
        var executionKnownIssues   = KnownIssues.GetExecutionKnownIssues(language, version);
        var snippetFileNames       = documentationLinks.Keys.ToList();

        return(from fileName in snippetFileNames                                                                               // e.g. application-addpassword-csharp-snippets.md
               let arbitraryDllPostfix = runSettings.DllPath == null || runSettings.Language != Languages.CSharp ? string.Empty : "arbitraryDll-"
                                         let testNamePostfix = arbitraryDllPostfix + version.ToString() + "-compiles"          // e.g. Beta-compiles or arbitraryDll-Beta-compiles
                                                               let testName = fileName.Replace("snippets.md", testNamePostfix) // e.g. application-addpassword-csharp-Beta-compiles
                                                                              let docsLink = documentationLinks[fileName]
                                                                                             let knownIssueLookupKey = testName.Replace("arbitraryDll-", string.Empty)
                                                                                                                       let executionIssueLookupKey = testName.Replace("-compiles", "-executes")
                                                                                                                                                     let isCompilationKnownIssue = compilationKnownIssues.ContainsKey(knownIssueLookupKey)
                                                                                                                                                                                   let compilationKnownIssue = isCompilationKnownIssue ? compilationKnownIssues[knownIssueLookupKey] : null
                                                                                                                                                                                                               let isExecutionKnownIssue = executionKnownIssues.ContainsKey(executionIssueLookupKey)
                                                                                                                                                                                                                                           let executionKnownIssue = isExecutionKnownIssue ? executionKnownIssues[executionIssueLookupKey] : null
                                                                                                                                                                                                                                                                     let knownIssueMessage = compilationKnownIssue?.Message ?? executionKnownIssue?.Message ?? string.Empty
                                                                                                                                                                                                                                                                                             let knownIssueTestNamePrefix = compilationKnownIssue?.TestNamePrefix ?? executionKnownIssue?.TestNamePrefix ?? string.Empty
                                                                                                                                                                                                                                                                                                                            let owner = compilationKnownIssue?.Owner ?? executionKnownIssue?.Owner ?? string.Empty
                                                                                                                                                                                                                                                                                                                                        let fullPath = Path.Join(GraphDocsDirectory.GetSnippetsDirectory(version, runSettings.Language), fileName)
                                                                                                                                                                                                                                                                                                                                                       let fileContent = File.ReadAllText(fullPath)
                                                                                                                                                                                                                                                                                                                                                                         select new LanguageTestData(
                   version,
                   isCompilationKnownIssue,
                   isExecutionKnownIssue,
                   knownIssueMessage,
                   knownIssueTestNamePrefix,
                   docsLink,
                   fileName,
                   runSettings.DllPath,
                   runSettings.JavaCoreVersion,
                   runSettings.JavaLibVersion,
                   runSettings.JavaPreviewLibPath,
                   testName,
                   owner,
                   fileContent));
    }