@@ -21,7 +21,7 @@ public class GetNamesAnalyzerTests
2121 public async Task EmptySourceShouldNotHaveDiagnostics ( )
2222 {
2323 var test = string . Empty ;
24- await VerifyAnalyzerAsync ( test ) ;
24+ await Verifier . VerifyAnalyzerAsync ( test ) ;
2525 }
2626
2727 [ Fact ]
@@ -38,7 +38,7 @@ public void TestMethod()
3838 }
3939 }
4040 """ ) ;
41- await VerifyAnalyzerAsync ( test ) ;
41+ await Verifier . VerifyAnalyzerAsync ( test ) ;
4242 }
4343
4444 [ Fact ]
@@ -67,7 +67,7 @@ public void TestMethod()
6767 }
6868 }
6969 """ ) ;
70- await VerifyCodeFix ( test , fix ) ;
70+ await Verifier . VerifyCodeFixAsync ( test , fix ) ;
7171 }
7272
7373 [ Fact ]
@@ -128,7 +128,7 @@ public void TestMethod()
128128 }
129129 }
130130 """ ) ;
131- await VerifyCodeFix ( test , fix ) ;
131+ await Verifier . VerifyCodeFixAsync ( test , fix ) ;
132132 }
133133
134134 [ Fact ]
@@ -157,7 +157,7 @@ public void TestMethod()
157157 }
158158 }
159159 """ ) ;
160- await VerifyCodeFix ( test , fix ) ;
160+ await Verifier . VerifyCodeFixAsync ( test , fix ) ;
161161 }
162162
163163 [ Fact ]
@@ -188,7 +188,7 @@ public void TestMethod()
188188 }
189189 }
190190 """ ) ;
191- await VerifyCodeFix ( test , fix ) ;
191+ await Verifier . VerifyCodeFixAsync ( test , fix ) ;
192192 }
193193
194194 [ Fact ]
@@ -216,7 +216,7 @@ public string[] TestMethod()
216216 }
217217 }
218218 """ ) ;
219- await VerifyCodeFix ( test , fix ) ;
219+ await Verifier . VerifyCodeFixAsync ( test , fix ) ;
220220 }
221221
222222 [ Fact ]
@@ -244,7 +244,7 @@ public void TestMethod()
244244 }
245245 }
246246 """ ) ;
247- await VerifyCodeFix ( test , fix ) ;
247+ await Verifier . VerifyCodeFixAsync ( test , fix ) ;
248248 }
249249
250250 [ Fact ]
@@ -289,7 +289,7 @@ public void TestMethod()
289289 }
290290 }
291291 """ ) ;
292- await VerifyAnalyzerAsync ( test ) ;
292+ await Verifier . VerifyAnalyzerAsync ( test ) ;
293293 }
294294
295295 [ Fact ]
@@ -397,36 +397,7 @@ public void TestMethod()
397397 }
398398 }
399399 """ ) ;
400- await VerifyCodeFix ( test , fix ) ;
401- }
402-
403- [ Fact ]
404- public async Task GetNamesInLinqExpressionShouldHaveDiagnostic ( )
405- {
406- var test = GetTestCode (
407- /* lang=c# */
408- """
409- public class TestClass
410- {
411- public void TestMethod()
412- {
413- var names = {|NEEG008:Enum.GetNames<MyEnum>()|}.Where(x => x.StartsWith("F"));
414- }
415- }
416- """ ) ;
417-
418- var fix = GetTestCode (
419- /* lang=c# */
420- """
421- public class TestClass
422- {
423- public void TestMethod()
424- {
425- var names = MyEnumExtensions.GetNames().Where(x => x.StartsWith("F"));
426- }
427- }
428- """ ) ;
429- await VerifyCodeFixWithNet6AssembliesAsync ( test , fix ) ;
400+ await Verifier . VerifyCodeFixAsync ( test , fix ) ;
430401 }
431402
432403 private static Task VerifyCodeFixWithNet6AssembliesAsync ( string source , string fixedSource )
@@ -441,66 +412,38 @@ private static Task VerifyCodeFixWithNet6AssembliesAsync(string source, string f
441412 return test . RunAsync ( CancellationToken . None ) ;
442413 }
443414
444- private static Task VerifyAnalyzerAsync ( string source )
445- {
446- var test = new Test
447- {
448- TestCode = source ,
449- ReferenceAssemblies = ReferenceAssemblies . Default
450- #if NETFRAMEWORK || NETCOREAPP2_1
451- . WithPackages ( [ new PackageIdentity ( "System.Memory" , "4.6.3" ) ] ) ,
452- #endif
453- } ;
454-
455- return test . RunAsync ( CancellationToken . None ) ;
456- }
457-
458- private static Task VerifyCodeFix ( string source , string fixedSource )
459- {
460- var test = new Test
461- {
462- TestCode = source ,
463- FixedCode = fixedSource ,
464- ReferenceAssemblies = ReferenceAssemblies . Default
465- #if NETFRAMEWORK || NETCOREAPP2_1
466- . WithPackages ( [ new PackageIdentity ( "System.Memory" , "4.6.3" ) ] ) ,
467- #endif
468- } ;
469-
470- return test . RunAsync ( CancellationToken . None ) ;
471- }
472-
473- private static string GetTestCodeWithExternalEnum ( string testCode ) => $$ """
474- using System;
475- using System.Collections.Generic;
476- using System.IO;
477- using System.Linq;
478- using System.Text;
479- using System.Threading;
480- using System.Threading.Tasks;
481- using System.Diagnostics;
482- using NetEscapades.EnumGenerators;
483-
484- [assembly: EnumExtensions<System.IO.FileShare>()]
485-
486- namespace ConsoleApplication1
487- {
488- {{ testCode }}
489-
490- }
491-
492- namespace System.IO
493- {
494- // This code would be generated, just hacked in here for simplicity
495- public static class FileShareExtensions
496- {
497- public static string[] GetNames() => new[] { "Read", "Write" };
498- }
499- }
415+ private static string GetTestCodeWithExternalEnum ( string testCode ) =>
416+ $$ """
417+ using System;
418+ using System.Collections.Generic;
419+ using System.IO;
420+ using System.Linq;
421+ using System.Text;
422+ using System.Threading;
423+ using System.Threading.Tasks;
424+ using System.Diagnostics;
425+ using NetEscapades.EnumGenerators;
426+
427+ [assembly: EnumExtensions<System.IO.FileShare>()]
428+
429+ namespace ConsoleApplication1
430+ {
431+ {{ testCode }}
432+
433+ }
434+
435+ namespace System.IO
436+ {
437+ // This code would be generated, just hacked in here for simplicity
438+ public static class FileShareExtensions
439+ {
440+ public static string[] GetNames() => new[] { "Read", "Write" };
441+ }
442+ }
500443
501- {{ TestHelpers . LoadEmbeddedAttribute ( ) }}
502- {{ TestHelpers . LoadEmbeddedMetadataSource ( ) }}
503- """ ;
444+ {{ TestHelpers . LoadEmbeddedAttribute ( ) }}
445+ {{ TestHelpers . LoadEmbeddedMetadataSource ( ) }}
446+ """ ;
504447
505448 private static string GetTestCode ( string testCode ) => $$ """
506449 using System;
0 commit comments