Code fix tests
As with the analyzer, you can create tests specific to code fixes. It uses a different verifier than the analyzer: CodeFixVerifier. Let’s get started:
- Add a file called CodeFixTests within the ExceptionShouldNotBeSuffixed folder in the Roslyn.Extensions.Test project folder. Then add a file called CodeFixTests.cs and add the following content to it:
namespace Roslyn.Extensions.CodeAnalysis .ExceptionShouldNotBeSuffixed; using Xunit; using Verify = Microsoft.CodeAnalysis.Csharp .Testing.XUnit.CodeFixVerifier<Analyzer, CodeFix>; public class CodeFixTests { }
As you did with the analyzer tests, you used a verifier. For code fixes, it is a different type of verifier: CodeFixVerifier.
The CodeFixVerifier verifier needs two generic arguments, the first one representing the analyzer and the second representing the code fix being tested.
- Add the following test method to the CodeFixTests class:
[Fact] public async Task...