@@ -23,13 +23,23 @@ public async Task TestFileHeaderWithShorthandCopyrightAsync()
2323 {
2424 var testCode = @"// <copyright file=""Test0.cs"" company=""FooCorp""/>
2525
26+ namespace Bar
27+ {
28+ }
29+ " ;
30+ var fixedCode = @"// <copyright file=""Test0.cs"" company=""FooCorp"">
31+ // Copyright (c) FooCorp. All rights reserved.
32+ // </copyright>
33+
2634namespace Bar
2735{
2836}
2937" ;
3038
3139 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1635Descriptor ) . WithLocation ( 1 , 4 ) ;
3240 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
41+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
42+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
3343 }
3444
3545 /// <summary>
@@ -47,14 +57,25 @@ public async Task TestFileHeaderWithWhitespaceOnlyCopyrightAsync()
4757 "namespace Bar\r \n " +
4858 "{\r \n " +
4959 "}\r \n " ;
60+ string fixedCode =
61+ "// <copyright file=\" Test0.cs\" company=\" FooCorp\" >\r \n " +
62+ "// Copyright (c) FooCorp. All rights reserved.\r \n " +
63+ "// </copyright>\r \n " +
64+ "\r \n " +
65+ "namespace Bar\r \n " +
66+ "{\r \n " +
67+ "}\r \n " ;
5068
5169 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1635Descriptor ) . WithLocation ( 1 , 4 ) ;
5270 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
71+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
72+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
5373 }
5474
75+ /// <inheritdoc/>
5576 protected override CodeFixProvider GetCSharpCodeFixProvider ( )
5677 {
57- throw new System . NotImplementedException ( ) ;
78+ return new FileHeaderCodeFixProvider ( ) ;
5879 }
5980 }
6081}
0 commit comments