Open damirarh opened 1 year ago
Imported comment written by Cezary Piątek on 2019-09-05T20:45:48
Testing analyzers with the default infrastructure provided by the template project is quite complicated. There is a nice project RoslynNUnitLight create by Dustin Campbell which makes testing of Roslyn analyzers, code fixes and refactorings super easy. Unfortunately, it's no longer maintained. I created a fork and made a few adjustments, like:
- Removed dependencies from the unit test framework. Now you can create a test with your favorite framework: xunit, nunit, mstest, etc.
- Added ability to locate diagnostic position by the line number
- Added infrastructure for testing CompletionProviders
- Improved error messages
- Presents code diff using diff tool in debug mode
This fork is called RoslynTestKit and it's available on GitHub https://github.com/cezarypi...
Nuget package: https://www.nuget.org/packa...
You can find sample tests built with RoslynTestKit in this project https://github.com/smartana...
Imported
URL: https://www.damirscorner.com/blog/posts/20150509-QuickGuideToUnitTestingDiagnosticAnalyzers.html