-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDiagnosticVerifierArguments.cs
33 lines (26 loc) · 1.05 KB
/
DiagnosticVerifierArguments.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections.Generic;
using FluentAssertions.Analyzers.TestUtils;
using Microsoft.CodeAnalysis.Diagnostics;
namespace FluentAssertions.Analyzers.Tests;
public class DiagnosticVerifierArguments : CsProjectArguments
{
public List<LegacyDiagnosticResult> ExpectedDiagnostics { get; } = new();
public List<DiagnosticAnalyzer> DiagnosticAnalyzers { get; } = new();
public DiagnosticVerifierArguments() { }
public DiagnosticVerifierArguments WithDiagnosticAnalyzer<TDiagnosticAnalyzer>() where TDiagnosticAnalyzer : DiagnosticAnalyzer, new()
{
DiagnosticAnalyzers.Add(new TDiagnosticAnalyzer());
return this;
}
public DiagnosticVerifierArguments WithAllAnalyzers()
{
DiagnosticAnalyzers.Clear();
DiagnosticAnalyzers.AddRange(CodeAnalyzersUtils.GetAllAnalyzers());
return this;
}
public DiagnosticVerifierArguments WithExpectedDiagnostics(params LegacyDiagnosticResult[] expectedDiagnostics)
{
ExpectedDiagnostics.AddRange(expectedDiagnostics);
return this;
}
}