@@ -13,6 +13,7 @@ namespace StyleCop.Analyzers.Test.ReadabilityRules
1313 using System . Threading ;
1414 using System . Threading . Tasks ;
1515 using Microsoft . CodeAnalysis . Testing ;
16+ using StyleCop . Analyzers . Test . Helpers ;
1617 using Xunit ;
1718 using static StyleCop . Analyzers . Test . Verifiers . StyleCopCodeFixVerifier <
1819 StyleCop . Analyzers . ReadabilityRules . SA1116SplitParametersMustStartOnLineAfterDeclaration ,
@@ -273,8 +274,10 @@ class ObsoleteType
273274 await VerifyCSharpDiagnosticAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
274275 }
275276
276- [ Fact ]
277- public async Task TestInvalidAttributeAsync ( )
277+ [ Theory ]
278+ [ InlineData ( "\n " ) ]
279+ [ InlineData ( "\r \n " ) ]
280+ public async Task TestInvalidAttributeAsync ( string lineEnding )
278281 {
279282 var testCode = @"
280283[System.AttributeUsage(System.AttributeTargets.Class)]
@@ -285,11 +288,11 @@ public MyAttribute(int a, int b)
285288 }
286289}
287290
288- [MyAttribute(1 ,
291+ [MyAttribute({|#0:1|} ,
289292 2)]
290293class Foo
291294{
292- }" ;
295+ }" . ReplaceLineEndings ( lineEnding ) ;
293296 var fixedCode = @"
294297[System.AttributeUsage(System.AttributeTargets.Class)]
295298public class MyAttribute : System.Attribute
@@ -304,9 +307,9 @@ public MyAttribute(int a, int b)
304307 2)]
305308class Foo
306309{
307- }" ;
310+ }" . ReplaceLineEndings ( lineEnding ) ;
308311
309- DiagnosticResult expected = Diagnostic ( ) . WithLocation ( 10 , 14 ) ;
312+ DiagnosticResult expected = Diagnostic ( ) . WithLocation ( 0 ) ;
310313 await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
311314 }
312315 }
0 commit comments