@@ -191,6 +191,278 @@ public async Task TestExcludedPrefixesAreNotReportedAsync()
191191 await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
192192 }
193193
194+ [ Fact ]
195+ public async Task TestParameterInInterfaceMethodParameterDeclarationAsync ( )
196+ {
197+ var testCode = @"
198+ public interface TypeName
199+ {
200+ void MethodName(bool abX);
201+ }" ;
202+
203+ DiagnosticResult [ ] expected =
204+ {
205+ this . CSharpDiagnostic ( ) . WithArguments ( "parameter" , "abX" ) . WithLocation ( 4 , 26 ) ,
206+ } ;
207+
208+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
209+ }
210+
211+ [ Fact ]
212+ public async Task TestParameterInClassMethodAsync ( )
213+ {
214+ var testCode = @"
215+ public class TypeName
216+ {
217+ public void MethodName(bool abX)
218+ {
219+ }
220+ }" ;
221+
222+ DiagnosticResult [ ] expected =
223+ {
224+ this . CSharpDiagnostic ( ) . WithArguments ( "parameter" , "abX" ) . WithLocation ( 4 , 33 ) ,
225+ } ;
226+
227+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
228+ }
229+
230+ [ Fact ]
231+ public async Task TestParameterInNativeClassMethodAsync ( )
232+ {
233+ var testCode = @"
234+ public class TypeNameNativeMethods
235+ {
236+ public void MethodName(bool abX)
237+ {
238+ }
239+ }" ;
240+
241+ await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
242+ }
243+
244+ [ Fact ]
245+ public async Task TestParameterInImplementedInterfaceMethodDeclarationAsync ( )
246+ {
247+ var testCode = @"
248+ public interface Interface
249+ {
250+ void MethodName(bool x);
251+ }
252+
253+ public class Class : Interface
254+ {
255+ public void MethodName(bool abX)
256+ {
257+ }
258+ }" ;
259+
260+ await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
261+ }
262+
263+ [ Fact ]
264+ public async Task TestParameterInIndirectlyImplementedInterfaceMethodDeclarationAsync ( )
265+ {
266+ var testCode = @"
267+ public interface Interface1
268+ {
269+ void MethodName(bool x);
270+ }
271+
272+ public interface Interface2 : Interface1
273+ {
274+ }
275+
276+ public class Class : Interface2
277+ {
278+ public void MethodName(bool abX)
279+ {
280+ }
281+ }" ;
282+
283+ await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
284+ }
285+
286+ [ Fact ]
287+ public async Task TestParameterInOverriddenMethodDeclarationAsync ( )
288+ {
289+ var testCode = @"
290+ public class BaseClass
291+ {
292+ public virtual void MethodName(bool x)
293+ {
294+ }
295+ }
296+
297+ public class SubClass : BaseClass
298+ {
299+ public override void MethodName(bool abX)
300+ {
301+ }
302+ }" ;
303+
304+ await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
305+ }
306+
307+ [ Fact ]
308+ public async Task TestParameterInConstructorDeclarationAsync ( )
309+ {
310+ var testCode = @"
311+ public class TypeName
312+ {
313+ public TypeName(string abX)
314+ {
315+ }
316+ }" ;
317+
318+ DiagnosticResult [ ] expected =
319+ {
320+ this . CSharpDiagnostic ( ) . WithArguments ( "parameter" , "abX" ) . WithLocation ( 4 , 28 ) ,
321+ } ;
322+
323+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
324+ }
325+
326+ [ Fact ]
327+ public async Task TestParameterInIndexerDeclarationAsync ( )
328+ {
329+ var testCode = @"
330+ public class TypeName
331+ {
332+ public int this[int abX]
333+ {
334+ get { return 0; }
335+ }
336+ }" ;
337+
338+ DiagnosticResult [ ] expected =
339+ {
340+ this . CSharpDiagnostic ( ) . WithArguments ( "parameter" , "abX" ) . WithLocation ( 4 , 25 ) ,
341+ } ;
342+
343+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
344+ }
345+
346+ [ Fact ]
347+ public async Task TestParameterInImplementedInterfaceIndexerMethodDeclarationAsync ( )
348+ {
349+ var testCode = @"
350+ public interface Interface
351+ {
352+ int this[int x] { get; }
353+ }
354+
355+ public class Class : Interface
356+ {
357+ public int this[int abX]
358+ {
359+ get { return 0; }
360+ }
361+ }" ;
362+
363+ await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
364+ }
365+
366+ [ Fact ]
367+ public async Task TestParameterInIndirectlyImplementedInterfaceIndexerDeclarationAsync ( )
368+ {
369+ var testCode = @"
370+ public interface Interface1
371+ {
372+ int this[int x] { get; }
373+ }
374+
375+ public interface Interface2 : Interface1
376+ {
377+ }
378+
379+ public class Class : Interface2
380+ {
381+ public int this[int abX]
382+ {
383+ get { return 0; }
384+ }
385+ }" ;
386+
387+ await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
388+ }
389+
390+ [ Fact ]
391+ public async Task TestParameterInOverriddenIndexerDeclarationAsync ( )
392+ {
393+ var testCode = @"
394+ public class BaseClass
395+ {
396+ public virtual int this[int x]
397+ {
398+ get { return 0; }
399+ }
400+ }
401+
402+ public class SubClass : BaseClass
403+ {
404+ public override int this[int abX]
405+ {
406+ get { return 0; }
407+ }
408+ }" ;
409+
410+ await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
411+ }
412+
413+ [ Fact ]
414+ public async Task TestParameterInLambdaDeclarationAsync ( )
415+ {
416+ var testCode = @"
417+ using System;
418+ public class TypeName
419+ {
420+ public void Method()
421+ {
422+ Func<float, float> y = (float abX) => abX;
423+ }
424+ }" ;
425+
426+ DiagnosticResult [ ] expected =
427+ {
428+ this . CSharpDiagnostic ( ) . WithArguments ( "parameter" , "abX" ) . WithLocation ( 7 , 39 ) ,
429+ } ;
430+
431+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
432+ }
433+
434+ [ Fact ]
435+ public async Task TestParameterInGlobalDelegateDeclarationAsync ( )
436+ {
437+ var testCode = @"
438+ public delegate void Delegate(double abX);
439+ " ;
440+
441+ DiagnosticResult [ ] expected =
442+ {
443+ this . CSharpDiagnostic ( ) . WithArguments ( "parameter" , "abX" ) . WithLocation ( 2 , 38 ) ,
444+ } ;
445+
446+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
447+ }
448+
449+ [ Fact ]
450+ public async Task TestParameterInInnerDelegateDeclarationAsync ( )
451+ {
452+ var testCode = @"
453+ public class TypeName
454+ {
455+ public delegate void Delegate(double abX);
456+ }" ;
457+
458+ DiagnosticResult [ ] expected =
459+ {
460+ this . CSharpDiagnostic ( ) . WithArguments ( "parameter" , "abX" ) . WithLocation ( 4 , 42 ) ,
461+ } ;
462+
463+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
464+ }
465+
194466 [ Fact ]
195467 public async Task TestVariableInCatchDeclarationAsync ( )
196468 {
0 commit comments