2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
4
using System ;
5
+ using System . Collections . Generic ;
5
6
using System . Collections . Immutable ;
6
7
using Microsoft . CodeAnalysis ;
7
8
using Microsoft . CodeAnalysis . CSharp ;
@@ -15,11 +16,7 @@ public static class CSharpGeneratorVerifier<TSourceGenerator>
15
16
where TSourceGenerator : ISourceGenerator , new ( )
16
17
#endif
17
18
{
18
- #if ROSLYN4_0_OR_GREATER
19
- public class Test : CSharpIncrementalGeneratorTest < TSourceGenerator , DefaultVerifier >
20
- #else
21
- public class Test : CSharpSourceGeneratorTest < TSourceGenerator , DefaultVerifier >
22
- #endif
19
+ public class Test : CSharpSourceGeneratorTest < EmptySourceGeneratorProvider , DefaultVerifier >
23
20
{
24
21
public Test ( )
25
22
{
@@ -48,6 +45,18 @@ private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarnings
48
45
protected override ParseOptions CreateParseOptions ( )
49
46
=> ( ( CSharpParseOptions ) base . CreateParseOptions ( ) ) . WithLanguageVersion ( LanguageVersion ) ;
50
47
48
+ #if ROSLYN4_0_OR_GREATER
49
+ protected override IEnumerable < ISourceGenerator > GetSourceGenerators ( )
50
+ {
51
+ yield return new TSourceGenerator ( ) . AsSourceGenerator ( ) ;
52
+ }
53
+ #else
54
+ protected override IEnumerable < ISourceGenerator > GetSourceGenerators ( )
55
+ {
56
+ yield return new TSourceGenerator ( ) ;
57
+ }
58
+ #endif
59
+
51
60
protected override bool IsCompilerDiagnosticIncluded ( Diagnostic diagnostic , CompilerDiagnostics compilerDiagnostics ) => false ;
52
61
}
53
62
}
0 commit comments