https://github.com/ufcpp/conventioncodefixverifier
https://github.com/ufcpp/conventioncodefixverifier
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ufcpp/conventioncodefixverifier
- Owner: ufcpp
- License: mit
- Created: 2015-06-10T10:53:13.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-07-05T10:53:52.000Z (over 3 years ago)
- Last Synced: 2025-04-09T01:41:24.780Z (10 months ago)
- Language: C#
- Size: 479 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ConventionCodeFixVerifier
Extends the `CodeFixVerifier` class in the "Analyzer with Code Fix" project template to read test cases from .cs files by naming convention.
## Convention
The naming convention is:
### Convention Version 1
- Put the following files in a folder `/DataSource/[test class name]/[test method name]`
- `Source.cs`: an input source code for your Analyzer/Code Fix
- `Result.json`: diagnostic results of the Source.cs by your Analyzer
- `NewSource.cs`: an output source code by your Code Fix
- Then, `VerifyDiagnostic` calls
- if the folder contains only `Source.cs`
- `CodeFixVerifier.VerifyCSharpDiagnostic([read from Source.cs])`
- if the folder contains `Source.cs` and `Result.json`
- `CodeFixVerifier.VerifyCSharpDiagnostic([read from Source.cs], [read from Result.json])`
- if the folder contains `Source.cs`, `Result.json`, and `NewSource.cs`
- `CodeFixVerifier.VerifyCSharpDiagnostic([read from Source.cs], [read from Result.json])`
- `CodeFixVerifier.VerifyCSharpFix([read from Source.cs], [read from NewSource.cs])`
### Convention Version 2
- Put the following files/subfolders in a folder `/DataSource/[test class name]/[test method name]`
- `*.cs` in `Source`: inputs for your Analyzer/Code Fix
- `*.json` in `Diagnostic`: diagnostic results of the Source.cs by your Analyzer
- `*.cs` in `Expected{n}`: output source codes by the n-th action of your Code Fix
## NuGet package
https://www.nuget.org/packages/ConventionCodeFixVerifier/
- Install-Package ConventionCodeFixVerifier
from your analyzer's test project.