Esempio n. 1
0
        public async Task TestFilterDiagnostics_InDiagnosticsList()
        {
            var solution = await GetSolutionAsync();

            var projectAnalyzersAndFixers = await GetProjectAnalyzersAndFixersAsync(solution);

            var project          = solution.Projects.First();
            var formattablePaths = ImmutableHashSet.Create(project.Documents.First().FilePath);
            var minimumSeverity  = DiagnosticSeverity.Warning;
            var diagnostics      = ImmutableHashSet.Create("DiagnosticAnalyzerId");
            var result           = await AnalyzerFormatter.FilterAnalyzersAsync(
                solution,
                projectAnalyzersAndFixers,
                formattablePaths,
                minimumSeverity,
                diagnostics,
                CancellationToken.None);

            var(_, analyzers) = Assert.Single(result);
            Assert.Single(analyzers);
        }
Esempio n. 2
0
        public async Task TestFilterError()
        {
            var solution = await GetSolutionAsync();

            var projectAnalyzersAndFixers = await GetProjectAnalyzersAndFixersAsync(solution);

            var project            = solution.Projects.First();
            var formattablePaths   = ImmutableHashSet.Create(project.Documents.First().FilePath);
            var minimumSeverity    = DiagnosticSeverity.Error;
            var diagnostics        = ImmutableHashSet <string> .Empty;
            var excludeDiagnostics = ImmutableHashSet <string> .Empty;
            var result             = await AnalyzerFormatter.FilterAnalyzersAsync(
                solution,
                projectAnalyzersAndFixers,
                formattablePaths,
                minimumSeverity,
                diagnostics,
                excludeDiagnostics,
                CancellationToken.None);

            var(_, analyzers) = Assert.Single(result);
            Assert.Empty(analyzers);
        }