-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCSharpCodeRefactoringVerifier`1+Test.cs
More file actions
31 lines (28 loc) · 1.15 KB
/
CSharpCodeRefactoringVerifier`1+Test.cs
File metadata and controls
31 lines (28 loc) · 1.15 KB
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
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CSharp.Testing;
using Microsoft.CodeAnalysis.Testing;
namespace Funcky.Analyzers.Test;
public static partial class CSharpCodeRefactoringVerifier<TCodeRefactoring>
where TCodeRefactoring : CodeRefactoringProvider, new()
{
public class Test : CSharpCodeRefactoringTest<TCodeRefactoring, DefaultVerifier>
{
public Test()
{
SolutionTransforms.Add((solution, projectId) =>
{
var project = solution.GetProject(projectId);
if (project is not null)
{
var compilationOptions = project.CompilationOptions;
if (compilationOptions is not null)
{
compilationOptions = compilationOptions.WithSpecificDiagnosticOptions(compilationOptions.SpecificDiagnosticOptions.SetItems(CSharpVerifierHelper.NullableWarnings));
solution = solution.WithProjectCompilationOptions(projectId, compilationOptions);
}
}
return solution;
});
}
}
}