@@ -25,13 +25,23 @@ public async Task TestCopyrightElementWithWrongCompanyAttributeAsync()
2525// Copyright (c) FooCorp. All rights reserved.
2626// </copyright>
2727
28+ namespace Bar
29+ {
30+ }
31+ " ;
32+ var fixedCode = @"// <copyright file=""Test0.cs"" company=""FooCorp"">
33+ // Copyright (c) FooCorp. All rights reserved.
34+ // </copyright>
35+
2836namespace Bar
2937{
3038}
3139" ;
3240
3341 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1641Descriptor ) . WithLocation ( 1 , 4 ) ;
3442 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
43+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
44+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
3545 }
3646
3747 /// <summary>
@@ -45,18 +55,28 @@ public async Task TestCopyrightElementWithInvalidCaseCompanyAttributeAsync()
4555// Copyright (c) FooCorp. All rights reserved.
4656// </copyright>
4757
58+ namespace Bar
59+ {
60+ }
61+ " ;
62+ var fixedCode = @"// <copyright file=""Test0.cs"" company=""FooCorp"">
63+ // Copyright (c) FooCorp. All rights reserved.
64+ // </copyright>
65+
4866namespace Bar
4967{
5068}
5169" ;
5270
5371 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1641Descriptor ) . WithLocation ( 1 , 4 ) ;
5472 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
73+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
74+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
5575 }
5676
5777 protected override CodeFixProvider GetCSharpCodeFixProvider ( )
5878 {
59- throw new System . NotImplementedException ( ) ;
79+ return new FileHeaderCodeFixProvider ( ) ;
6080 }
6181 }
6282}
0 commit comments