@@ -28,13 +28,27 @@ public async Task TestFileHeaderWithMissingCopyrightTagAsync()
2828// </author>
2929// <summary>This is a test file.</summary>
3030
31+ namespace Bar
32+ {
33+ }
34+ " ;
35+ var fixedCode = @"// <copyright file=""Test0.cs"" company=""FooCorp"">
36+ // Copyright (c) FooCorp. All rights reserved.
37+ // </copyright>
38+ // <author>
39+ // John Doe
40+ // </author>
41+ // <summary>This is a test file.</summary>
42+
3143namespace Bar
3244{
3345}
3446" ;
3547
3648 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1634Descriptor ) . WithLocation ( 1 , 1 ) ;
3749 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
50+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
51+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
3852 }
3953
4054 /// <summary>
@@ -68,13 +82,23 @@ public async Task TestValidFileHeaderWithShorthandCopyrightAsync()
6882 {
6983 var testCode = @"// <copyright file=""Test0.cs"" company=""FooCorp""/>
7084
85+ namespace Bar
86+ {
87+ }
88+ " ;
89+ var fixedCode = @"// <copyright file=""Test0.cs"" company=""FooCorp"">
90+ // Copyright (c) FooCorp. All rights reserved.
91+ // </copyright>
92+
7193namespace Bar
7294{
7395}
7496" ;
7597
7698 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1635Descriptor ) . WithLocation ( 1 , 4 ) ;
7799 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
100+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
101+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
78102 }
79103
80104 /// <summary>
@@ -88,13 +112,26 @@ public async Task TestInvalidFileHeaderWithCopyrightInWrongCaseAsync()
88112// Copyright (c) FooCorp. All rights reserved.
89113// </Copyright>
90114
115+ namespace Bar
116+ {
117+ }
118+ " ;
119+ var fixedCode = @"// <copyright file=""Test0.cs"" company=""FooCorp"">
120+ // Copyright (c) FooCorp. All rights reserved.
121+ // </copyright>
122+ // <Copyright file=""Test0.cs"" company=""FooCorp"">
123+ // Copyright (c) FooCorp. All rights reserved.
124+ // </Copyright>
125+
91126namespace Bar
92127{
93128}
94129" ;
95130
96131 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1634Descriptor ) . WithLocation ( 1 , 1 ) ;
97132 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
133+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
134+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
98135 }
99136
100137 /// <summary>
@@ -162,7 +199,7 @@ namespace Bar
162199 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1634Descriptor ) . WithLocation ( 1 , 5 ) ;
163200 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
164201 await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
165- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
202+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
166203 }
167204
168205 /// <summary>
@@ -197,7 +234,7 @@ namespace Bar
197234 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1634Descriptor ) . WithLocation ( 1 , 1 ) ;
198235 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
199236 await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
200- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
237+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
201238 }
202239
203240 /// <summary>
@@ -234,7 +271,7 @@ namespace Bar
234271 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1634Descriptor ) . WithLocation ( 1 , 1 ) ;
235272 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
236273 await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
237- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
274+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
238275 }
239276
240277 /// <summary>
@@ -271,7 +308,7 @@ namespace Bar
271308 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1634Descriptor ) . WithLocation ( 1 , 1 ) ;
272309 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
273310 await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
274- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
311+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
275312 }
276313
277314 /// <summary>
@@ -316,7 +353,7 @@ namespace Bar
316353 var expectedDiagnostic = this . CSharpDiagnostic ( FileHeaderAnalyzers . SA1634Descriptor ) . WithLocation ( 1 , 1 ) ;
317354 await this . VerifyCSharpDiagnosticAsync ( testCode , expectedDiagnostic , CancellationToken . None ) . ConfigureAwait ( false ) ;
318355 await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
319- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
356+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
320357 }
321358
322359 protected override CodeFixProvider GetCSharpCodeFixProvider ( )
0 commit comments