Extends the CodeFixVerifier class in the "Analyzer with Code Fix" project template to read test cases from .cs files by naming convention.
The naming convention is:
- Put the following files in a folder
/DataSource/[test class name]/[test method name]Source.cs: an input source code for your Analyzer/Code FixResult.json: diagnostic results of the Source.cs by your AnalyzerNewSource.cs: an output source code by your Code Fix
- Then,
VerifyDiagnosticcalls- if the folder contains only
Source.csCodeFixVerifier.VerifyCSharpDiagnostic([read from Source.cs])
- if the folder contains
Source.csandResult.jsonCodeFixVerifier.VerifyCSharpDiagnostic([read from Source.cs], [read from Result.json])
- if the folder contains
Source.cs,Result.json, andNewSource.csCodeFixVerifier.VerifyCSharpDiagnostic([read from Source.cs], [read from Result.json])CodeFixVerifier.VerifyCSharpFix([read from Source.cs], [read from NewSource.cs])
- if the folder contains only
- Put the following files/subfolders in a folder
/DataSource/[test class name]/[test method name]*.csinSource: inputs for your Analyzer/Code Fix*.jsoninDiagnostic: diagnostic results of the Source.cs by your Analyzer*.csinExpected{n}: output source codes by the n-th action of your Code Fix
https://www.nuget.org/packages/ConventionCodeFixVerifier/
- Install-Package ConventionCodeFixVerifier
from your analyzer's test project.