@@ -227,6 +227,55 @@ void MethodName()
227227 await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
228228 }
229229
230+ [ Fact ]
231+ [ WorkItem ( 2468 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2468" ) ]
232+ public async Task TestCodeFixCommaPlacementAsync ( )
233+ {
234+ var testCode = @"using System;
235+
236+ public class TestClass
237+ {
238+ public void TestMethod()
239+ {
240+ var test = (new[]
241+ {
242+ new Tuple<int, int>(1, 2)
243+ ,new Tuple<int, int>(3, 4)
244+ ,new Tuple<int, int>(5, 6)
245+ }).ToString();
246+ }
247+ }
248+ " ;
249+
250+ var fixedCode = @"using System;
251+
252+ public class TestClass
253+ {
254+ public void TestMethod()
255+ {
256+ var test = (new[]
257+ {
258+ new Tuple<int, int>(1, 2),
259+ new Tuple<int, int>(3, 4),
260+ new Tuple<int, int>(5, 6)
261+ }).ToString();
262+ }
263+ }
264+ " ;
265+
266+ DiagnosticResult [ ] expected =
267+ {
268+ this . CSharpDiagnostic ( ) . WithArguments ( " not" , "preceded" ) . WithLocation ( 10 , 12 ) ,
269+ this . CSharpDiagnostic ( ) . WithArguments ( string . Empty , "followed" ) . WithLocation ( 10 , 12 ) ,
270+ this . CSharpDiagnostic ( ) . WithArguments ( " not" , "preceded" ) . WithLocation ( 11 , 12 ) ,
271+ this . CSharpDiagnostic ( ) . WithArguments ( string . Empty , "followed" ) . WithLocation ( 11 , 12 ) ,
272+ } ;
273+
274+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
275+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
276+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
277+ }
278+
230279 protected override IEnumerable < DiagnosticAnalyzer > GetCSharpDiagnosticAnalyzers ( )
231280 {
232281 yield return new SA1001CommasMustBeSpacedCorrectly ( ) ;
0 commit comments