public static async Task VerifyAsync <TAnalyzer>(this AnnotatedSourceFile sourceFile)
            where TAnalyzer : DiagnosticAnalyzer, new()
        {
            var type = sourceFile.LoadType();

            var expectedDiagnostics = type.GetCustomAttributes <NoExpectedDiagnosticAttribute>().Any()
                ? Array.Empty <DiagnosticResult>()
                : type.GetCustomAttributes <ExpectedDiagnosticAttribute>()
                                      .Select(d => AnalyzerVerifier <TAnalyzer> .Diagnostic(d.DiagnosticId)
                                              .WithLocation(d.Line, d.Column)
                                              .WithArguments(d.Arguments))
                                      .ToArray();

            await AnalyzerVerifier <TAnalyzer> .VerifyAnalyzerAsync(sourceFile.Content, expectedDiagnostics);
        }
 public async Task Verify(AnnotatedSourceFile sourceFile)
 {
     await sourceFile.VerifyAsync <OneLevelOfIndentationAnalyzer>();
 }
 public async Task Verify(AnnotatedSourceFile sourceFile)
 {
     await sourceFile.VerifyAsync <ObjectNotFullyInitializedAfterConstructorAnalyzer>();
 }
Ejemplo n.º 4
0
 public async Task Verify(AnnotatedSourceFile sourceFile)
 {
     await sourceFile.VerifyAsync <ConstructorContainsControlFlowAnalyzer>();
 }
Ejemplo n.º 5
0
 public async Task Verify(AnnotatedSourceFile sourceFile)
 {
     await sourceFile.VerifyAsync <TooManyParametersAnalyzer>();
 }
Ejemplo n.º 6
0
 public async Task Verify(AnnotatedSourceFile sourceFile)
 {
     await sourceFile.VerifyAsync <NegativeConditionalAnalyzer>();
 }