@@ -196,6 +196,38 @@ public async Task TestPreprocessorDirectivesAsync()
196196 await this . VerifyCSharpFixAsync ( testCode , fixedTestCode ) . ConfigureAwait ( false ) ;
197197 }
198198
199+ /// <summary>
200+ /// Verifies that the analyzer will not combine using directives that refer to the same type. This is a
201+ /// regression test for DotNetAnalyzers/StyleCopAnalyzers#2000.
202+ /// </summary>
203+ /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
204+ [ Fact ]
205+ public async Task TestSameUsingWithDifferentAliasAsync ( )
206+ {
207+ string testCode = @"namespace NamespaceName
208+ {
209+ using Func2 = System.Func<int>;
210+ using Func1 = System.Func<int>;
211+
212+ internal delegate void DelegateName(Func1 arg1, Func2 arg2);
213+ }
214+ " ;
215+ string fixedCode = @"namespace NamespaceName
216+ {
217+ using Func1 = System.Func<int>;
218+ using Func2 = System.Func<int>;
219+
220+ internal delegate void DelegateName(Func1 arg1, Func2 arg2);
221+ }
222+ " ;
223+
224+ var expected = this . CSharpDiagnostic ( ) . WithLocation ( 4 , 5 ) . WithArguments ( "Func1" , "Func2" ) ;
225+
226+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
227+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
228+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
229+ }
230+
199231 /// <inheritdoc/>
200232 protected override IEnumerable < DiagnosticAnalyzer > GetCSharpDiagnosticAnalyzers ( )
201233 {
0 commit comments