public void TestConstructionThroughVerifierActionableError2()
        {
            var error = Assert.Throws <InvalidOperationException>(() => AnalyzerVerifier <TwoDescriptorAnalyzer, CSharpAnalyzerTest <TwoDescriptorAnalyzer>, DefaultVerifier> .Diagnostic("ID"));

            Assert.Equal("'Diagnostic(string)' can only be used when the analyzer has a single supported diagnostic with the specified ID. Use the 'Diagnostic(DiagnosticDescriptor)' overload to specify the descriptor from which to create the expected result.", error.Message);
        }
Ejemplo n.º 2
0
 private static DiagnosticResult Diagnostic <TAnalyzer>()
     where TAnalyzer : DiagnosticAnalyzer, new()
 => AnalyzerVerifier <TAnalyzer, CSharpAnalyzerTest <TAnalyzer>, DefaultVerifier> .Diagnostic();
 /// <inheritdoc cref="AnalyzerVerifier{TAnalyzer, TTest, TVerifier}.VerifyAnalyzerAsync(string, DiagnosticResult[])"/>
 public static Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] expected)
 => AnalyzerVerifier <TAnalyzer, TTest, TVerifier> .VerifyAnalyzerAsync(source, expected);
 /// <inheritdoc cref="AnalyzerVerifier{TAnalyzer, TTest, TVerifier}.Diagnostic(DiagnosticDescriptor)"/>
 public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor)
 => AnalyzerVerifier <TAnalyzer, TTest, TVerifier> .Diagnostic(descriptor);
 /// <inheritdoc cref="AnalyzerVerifier{TAnalyzer, TTest, TVerifier}.Diagnostic(string)"/>
 public static DiagnosticResult Diagnostic(string diagnosticId)
 => AnalyzerVerifier <TAnalyzer, TTest, TVerifier> .Diagnostic(diagnosticId);
 /// <inheritdoc cref="AnalyzerVerifier{TAnalyzer, TTest, TVerifier}.Diagnostic()"/>
 public static DiagnosticResult Diagnostic()
 => AnalyzerVerifier <TAnalyzer, TTest, TVerifier> .Diagnostic();
Ejemplo n.º 7
0
 private static DiagnosticResult Diagnostic()
 => AnalyzerVerifier <HighlightBracesAnalyzer, CSharpTest, DefaultVerifier> .Diagnostic();