@@ -424,40 +424,25 @@ void Foo()
424424 await this . VerifyCSharpFixAsync ( test , fixedTest , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
425425 }
426426
427- [ Fact ]
427+ [ Theory ]
428+ [ InlineData ( "" ) ]
429+ [ InlineData ( " " ) ]
428430 [ WorkItem ( 2289 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2289" ) ]
429- public async Task TestSpaceBeforeUnaryOperatorInInterpolationAlignmentClauseAsync ( )
431+ public async Task TestSpaceBeforeUnaryOperatorInInterpolationAlignmentClauseAsync ( string spacing )
430432 {
431- string testFormat = @"namespace Namespace
433+ string test = $ @ "namespace Namespace
432434{{
433435 class Type
434436 {{
435437 void Foo()
436438 {{
437- string msg = $""{{5,{0} }}"";
439+ string msg = $""{{5,{ spacing } { this . Sign } 3 }}"";
438440 }}
439441 }}
440442}}
441443" ;
442444
443- // in all cases the final output should be the following
444- string fixedTest = @"namespace Namespace
445- {
446- class Type
447- {
448- void Foo()
449- {
450- string msg = $""{5, " + this . Sign + @"3}"";
451- }
452- }
453- }
454- " ;
455-
456- await this . VerifyCSharpDiagnosticAsync ( fixedTest , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
457-
458- string test = string . Format ( testFormat , " " + this . Sign + "3" ) ;
459445 await this . VerifyCSharpDiagnosticAsync ( test , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
460- await this . VerifyCSharpFixAsync ( test , fixedTest , numberOfFixAllIterations : 0 , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
461446 }
462447
463448 [ Fact ]
@@ -489,18 +474,17 @@ void Foo()
489474}
490475" ;
491476
492- await this . VerifyCSharpDiagnosticAsync ( fixedTest , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
493-
494477 string test = string . Format ( testFormat , this . Sign + "3" ) ;
495478 await this . VerifyCSharpDiagnosticAsync ( test , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
496- await this . VerifyCSharpFixAsync ( test , fixedTest , numberOfFixAllIterations : 0 , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
497479
498480 test = string . Format ( testFormat , this . Sign + " 3" ) ;
499- var expected = new [ ]
500- {
501- this . CSharpDiagnostic ( ) . WithArguments ( " not" , "followed" ) . WithLocation ( 7 , 31 ) ,
502- } ;
481+ DiagnosticResult [ ] expected =
482+ {
483+ this . CSharpDiagnostic ( ) . WithArguments ( " not" , "followed" ) . WithLocation ( 7 , 31 ) ,
484+ } ;
485+
503486 await this . VerifyCSharpDiagnosticAsync ( test , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
487+ await this . VerifyCSharpDiagnosticAsync ( fixedTest , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
504488 await this . VerifyCSharpFixAsync ( test , fixedTest , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
505489 }
506490
@@ -533,19 +517,17 @@ void Foo()
533517}
534518" ;
535519
536- await this . VerifyCSharpDiagnosticAsync ( fixedTest , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
537-
538520 string test = string . Format ( testFormat , " " + this . Sign + "3" ) ;
539521 await this . VerifyCSharpDiagnosticAsync ( test , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
540- await this . VerifyCSharpFixAsync ( test , fixedTest , numberOfFixAllIterations : 0 , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
541522
542523 test = string . Format ( testFormat , " " + this . Sign + " 3" ) ;
543- var expected =
544- new [ ]
545- {
546- this . CSharpDiagnostic ( ) . WithArguments ( " not" , "followed" ) . WithLocation ( 7 , 32 ) ,
547- } ;
524+ DiagnosticResult [ ] expected =
525+ {
526+ this . CSharpDiagnostic ( ) . WithArguments ( " not" , "followed" ) . WithLocation ( 7 , 32 ) ,
527+ } ;
528+
548529 await this . VerifyCSharpDiagnosticAsync ( test , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
530+ await this . VerifyCSharpDiagnosticAsync ( fixedTest , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
549531 await this . VerifyCSharpFixAsync ( test , fixedTest , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
550532 }
551533
0 commit comments