@@ -103,18 +103,6 @@ namespace System.Threading
103103 await VerifyCSharpDiagnosticAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
104104 }
105105
106- [ Fact ]
107- public async Task TestStaticUsingsAsync ( )
108- {
109- const string testCode = @"
110- namespace System.Threading
111- {
112- using static Console;
113- }" ;
114-
115- await VerifyCSharpDiagnosticAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
116- }
117-
118106 [ Fact ]
119107 public async Task TestFixAllAsync ( )
120108 {
@@ -455,5 +443,31 @@ namespace System
455443
456444 await VerifyCSharpDiagnosticAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
457445 }
446+
447+ [ Fact ]
448+ [ WorkItem ( 2618 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2618" ) ]
449+ public async Task TestUnqualifiedStaticUsingsAsync ( )
450+ {
451+ const string testCode = @"
452+ namespace System.Threading
453+ {
454+ using static Console;
455+ }
456+ " ;
457+
458+ const string fixedCode = @"
459+ namespace System.Threading
460+ {
461+ using static System.Console;
462+ }
463+ " ;
464+
465+ DiagnosticResult [ ] expected =
466+ {
467+ Diagnostic ( SA1135UsingDirectivesMustBeQualified . DescriptorType ) . WithLocation ( 4 , 5 ) . WithArguments ( "System.Console" ) ,
468+ } ;
469+
470+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
471+ }
458472 }
459473}
0 commit comments