@@ -25,13 +25,23 @@ public async Task TestCopyrightElementWithoutCompanyAttributeAsync()
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 . SA1640Descriptor ) . 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,13 +55,23 @@ public async Task TestCopyrightElementWithEmptyCompanyAttributeAsync()
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 . SA1640Descriptor ) . 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 /// <summary>
@@ -65,18 +85,28 @@ public async Task TestCopyrightElementWithWhitespaceOnlyCompanyAttributeAsync()
6585// Copyright (c) FooCorp. All rights reserved.
6686// </copyright>
6787
88+ namespace Bar
89+ {
90+ }
91+ " ;
92+ var fixedCode = @"// <copyright file=""Test0.cs"" company=""FooCorp"">
93+ // Copyright (c) FooCorp. All rights reserved.
94+ // </copyright>
95+
6896namespace Bar
6997{
7098}
7199" ;
72100
73101 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1640Descriptor ) . WithLocation ( 1 , 4 ) ;
74102 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
103+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
104+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
75105 }
76106
77107 protected override CodeFixProvider GetCSharpCodeFixProvider ( )
78108 {
79- throw new System . NotImplementedException ( ) ;
109+ return new FileHeaderCodeFixProvider ( ) ;
80110 }
81111 }
82112}
0 commit comments