@@ -8,6 +8,9 @@ namespace StyleCop.Analyzers.Test.CSharp7.NamingRules
88 using StyleCop . Analyzers . Test . NamingRules ;
99 using TestHelper ;
1010 using Xunit ;
11+ using static StyleCop . Analyzers . Test . Verifiers . StyleCopCodeFixVerifier <
12+ StyleCop . Analyzers . NamingRules . SA1312VariableNamesMustBeginWithLowerCaseLetter ,
13+ StyleCop . Analyzers . NamingRules . RenameToLowerCaseCodeFixProvider > ;
1114
1215 public class SA1312CSharp7UnitTests : SA1312UnitTests
1316 {
@@ -26,12 +29,10 @@ public void MethodName()
2629
2730 DiagnosticResult [ ] expected =
2831 {
29- this . CSharpDiagnostic ( ) . WithArguments ( "Bar" ) . WithLocation ( 5 , 35 ) ,
30- this . CSharpDiagnostic ( ) . WithArguments ( "Par" ) . WithLocation ( 7 , 35 ) ,
32+ Diagnostic ( ) . WithArguments ( "Bar" ) . WithLocation ( 5 , 35 ) ,
33+ Diagnostic ( ) . WithArguments ( "Par" ) . WithLocation ( 7 , 35 ) ,
3134 } ;
3235
33- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
34-
3536 var fixedCode = @"public class TypeName
3637{
3738 public void MethodName()
@@ -42,8 +43,7 @@ public void MethodName()
4243 }
4344}" ;
4445
45- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
46- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
46+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
4747 }
4848
4949 [ Fact ]
@@ -59,12 +59,10 @@ public void MethodName()
5959
6060 DiagnosticResult [ ] expected =
6161 {
62- this . CSharpDiagnostic ( ) . WithArguments ( "Bar" ) . WithLocation ( 5 , 14 ) ,
63- this . CSharpDiagnostic ( ) . WithArguments ( "Par" ) . WithLocation ( 5 , 24 ) ,
62+ Diagnostic ( ) . WithArguments ( "Bar" ) . WithLocation ( 5 , 14 ) ,
63+ Diagnostic ( ) . WithArguments ( "Par" ) . WithLocation ( 5 , 24 ) ,
6464 } ;
6565
66- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
67-
6866 var fixedCode = @"public class TypeName
6967{
7068 public void MethodName()
@@ -73,8 +71,7 @@ public void MethodName()
7371 }
7472}" ;
7573
76- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
77- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
74+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
7875 }
7976
8077 [ Fact ]
@@ -97,11 +94,8 @@ public void MethodName()
9794 }
9895}" ;
9996
100- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "_bar" ) . WithLocation ( 5 , 37 ) ;
101-
102- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
103- await this . VerifyCSharpDiagnosticAsync ( fixedTestCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
104- await this . VerifyCSharpFixAsync ( testCode , fixedTestCode ) . ConfigureAwait ( false ) ;
97+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "_bar" ) . WithLocation ( 5 , 37 ) ;
98+ await VerifyCSharpFixAsync ( testCode , expected , fixedTestCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
10599 }
106100
107101 [ Fact ]
@@ -136,11 +130,8 @@ public void MethodName()
136130 }
137131}" ;
138132
139- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "ArgEx" ) . WithLocation ( 10 , 60 ) ;
140-
141- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
142- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
143- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
133+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "ArgEx" ) . WithLocation ( 10 , 60 ) ;
134+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
144135 }
145136
146137 [ Fact ]
@@ -165,11 +156,8 @@ public void MethodName()
165156 }
166157}" ;
167158
168- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "X" ) . WithLocation ( 5 , 23 ) ;
169-
170- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
171- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
172- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
159+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "X" ) . WithLocation ( 5 , 23 ) ;
160+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
173161 }
174162
175163 [ Fact ]
@@ -200,11 +188,8 @@ public void MethodName()
200188 }
201189}" ;
202190
203- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "X" ) . WithLocation ( 7 , 18 ) ;
204-
205- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
206- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
207- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
191+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "X" ) . WithLocation ( 7 , 18 ) ;
192+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
208193 }
209194
210195 [ Fact ]
@@ -218,7 +203,7 @@ public void MethodName()
218203 }
219204}" ;
220205
221- await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
206+ await VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
222207 }
223208
224209 [ Fact ]
@@ -233,9 +218,7 @@ public void MethodName()
233218 }
234219}" ;
235220
236- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "Variable" ) . WithLocation ( 6 , 51 ) ;
237-
238- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
221+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "Variable" ) . WithLocation ( 6 , 51 ) ;
239222
240223 var fixedCode = @"public class TypeName
241224{
@@ -246,8 +229,7 @@ public void MethodName()
246229 }
247230}" ;
248231
249- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
250- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
232+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
251233 }
252234
253235 [ Fact ]
@@ -262,9 +244,7 @@ public void MethodName()
262244 }
263245}" ;
264246
265- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "Variable" ) . WithLocation ( 6 , 16 ) ;
266-
267- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
247+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "Variable" ) . WithLocation ( 6 , 16 ) ;
268248
269249 var fixedCode = @"public class TypeName
270250{
@@ -275,8 +255,7 @@ public void MethodName()
275255 }
276256}" ;
277257
278- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
279- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
258+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
280259 }
281260
282261 [ Fact ]
@@ -290,9 +269,7 @@ public void MethodName()
290269 }
291270}" ;
292271
293- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "Int" ) . WithLocation ( 5 , 38 ) ;
294-
295- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
272+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "Int" ) . WithLocation ( 5 , 38 ) ;
296273
297274 var fixedCode = @"public class TypeName
298275{
@@ -302,8 +279,7 @@ public void MethodName()
302279 }
303280}" ;
304281
305- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
306- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
282+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
307283 }
308284
309285 [ Fact ]
@@ -317,9 +293,7 @@ public void MethodName(int parameter)
317293 }
318294}" ;
319295
320- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "Parameter" ) . WithLocation ( 5 , 52 ) ;
321-
322- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
296+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "Parameter" ) . WithLocation ( 5 , 52 ) ;
323297
324298 var fixedCode = @"public class TypeName
325299{
@@ -329,8 +303,7 @@ public void MethodName(int parameter)
329303 }
330304}" ;
331305
332- await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
333- await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
306+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
334307 }
335308
336309 [ Fact ]
@@ -346,10 +319,8 @@ public void MethodName(int parameter)
346319 }
347320}" ;
348321
349- DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithArguments ( "__" ) . WithLocation ( 7 , 52 ) ;
350-
351- await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
352- await this . VerifyCSharpFixAsync ( testCode , testCode ) . ConfigureAwait ( false ) ;
322+ DiagnosticResult expected = Diagnostic ( ) . WithArguments ( "__" ) . WithLocation ( 7 , 52 ) ;
323+ await VerifyCSharpFixAsync ( testCode , expected , testCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
353324 }
354325 }
355326}
0 commit comments