@@ -212,13 +212,18 @@ private C()
212212 }
213213
214214 [ Theory ]
215+ [ InlineData ( "1" ) ]
215216 [ InlineData ( "1, \" B\" " ) ]
216217 [ InlineData ( "1, null" ) ]
217218 [ InlineData ( "default, \" B\" " ) ]
218219 [ InlineData ( "(int)default, default" ) ]
219220 [ InlineData ( "default, null, 1234" ) ]
220221 [ InlineData ( "1, \" An object\" , 3, null" ) ]
221222 [ InlineData ( "1, \" An object\" , 3, new System.IO.MemoryStream()" ) ]
223+ [ InlineData ( "[new string[] { \" A\" , \" B\" }]" ) ]
224+ [ InlineData ( "new object[] { new string[] { \" A\" , \" B\" } }" ) ]
225+ [ InlineData ( "[1]" ) ]
226+ [ InlineData ( "[1, \" A\" ]" ) ]
222227 public async Task Arguments_Match ( string parameters )
223228 {
224229 var source = @"
@@ -255,6 +260,10 @@ public C(int a, int[] b, int c)
255260 public C(int a, object b, int c, System.IDisposable d)
256261 {
257262 }
263+
264+ public C(string[] array)
265+ {
266+ }
258267 }
259268 }" ;
260269
@@ -340,6 +349,8 @@ public void TestMethod()
340349 [ InlineData ( "1, \" B\" " ) ]
341350 [ InlineData ( "1, \" An object\" , 3, null" ) ]
342351 [ InlineData ( "1, \" An object\" , 3, new System.IO.MemoryStream()" ) ]
352+ [ InlineData ( "[1]" ) ]
353+ [ InlineData ( "[1, \" A\" ]" ) ]
343354 public async Task Arguments_Match_WithMockBehavior ( string parameters )
344355 {
345356 var source = @"
@@ -372,6 +383,10 @@ public C(int a, object c)
372383 public C(int a, object b, int c, System.IDisposable d)
373384 {
374385 }
386+
387+ public C(string[] array)
388+ {
389+ }
375390 }
376391 }" ;
377392
@@ -408,6 +423,8 @@ public void TestMethod()
408423 [ InlineData ( "null" ) ]
409424 [ InlineData ( "\" The string\" , 2" ) ]
410425 [ InlineData ( "1, 2, 3, \" The string\" " ) ]
426+ [ InlineData ( "new int[] { 1, 2 }, 1000" ) ]
427+ [ InlineData ( "new object[] { \" A\" , \" B\" }, 1000" ) ]
411428 public async Task Arguments_NotMatch ( string parameters )
412429 {
413430 var source = @"
@@ -440,12 +457,56 @@ public C(int a, object c)
440457 public C(int a, object b, int c, System.IDisposable d)
441458 {
442459 }
460+
461+ public C(string[] array, int b)
462+ {
463+ }
443464 }
444465 }" ;
445466
446467 await Verifier . VerifyAnalyzerAsync ( source ) ;
447468 }
448469
470+ [ Theory ]
471+ [ InlineData ( "[]" ) ]
472+ public async Task Arguments_NotMatch_EmptyArray ( string parameters )
473+ {
474+ var source = @"
475+ namespace ConsoleApplication1
476+ {
477+ using Moq;
478+
479+ public class TestClass
480+ {
481+ public void TestMethod()
482+ {
483+ var mock = new Mock<C>{|PosInfoMoq2005:(" + parameters + @")|};
484+ }
485+ }
486+
487+ public class C
488+ {
489+ public C(int a)
490+ {
491+ }
492+
493+ public C(int a, string b)
494+ {
495+ }
496+
497+ public C(int a, object c)
498+ {
499+ }
500+
501+ public C(string[] array, int b)
502+ {
503+ }
504+ }
505+ }" ;
506+
507+ await Verifier . VerifyAnalyzerAsync ( source ) ;
508+ }
509+
449510 [ Fact ]
450511 public async Task Arguments_WithDefaultParameters ( )
451512 {
@@ -474,7 +535,7 @@ public C(int a = 0, int b = 1, int c = 2, int d = 3)
474535 }
475536
476537 [ Fact ]
477- public async Task Arguments_NotMatch_WithNoContructor ( )
538+ public async Task Arguments_NotMatch_WithNoConstructor ( )
478539 {
479540 var source = @"
480541 namespace ConsoleApplication1
@@ -500,6 +561,7 @@ public class ClassWithNoConstructor { }
500561 [ InlineData ( "null" ) ]
501562 [ InlineData ( "\" The string\" , 2" ) ]
502563 [ InlineData ( "1, 2, 3, \" The string\" " ) ]
564+ [ InlineData ( "new int[] { 1, 2 }, 1000" ) ]
503565 public async Task Arguments_NotMatch_WithMockBehavior ( string parameters )
504566 {
505567 var source = @"
@@ -528,6 +590,50 @@ public C(int a, string b)
528590 public C(int a, object c)
529591 {
530592 }
593+
594+ public C(string[] array, int b)
595+ {
596+ }
597+ }
598+ }" ;
599+
600+ await Verifier . VerifyAnalyzerAsync ( source ) ;
601+ }
602+
603+ [ Theory ]
604+ [ InlineData ( "[]" ) ]
605+ public async Task Arguments_NotMatch_WithMockBehavior_EmptyArray ( string parameters )
606+ {
607+ var source = @"
608+ namespace ConsoleApplication1
609+ {
610+ using Moq;
611+
612+ public class TestClass
613+ {
614+ public void TestMethod()
615+ {
616+ var mock = new Mock<C>{|PosInfoMoq2005:(MockBehavior.Strict, " + parameters + @")|};
617+ }
618+ }
619+
620+ public class C
621+ {
622+ public C(int a)
623+ {
624+ }
625+
626+ public C(int a, string b)
627+ {
628+ }
629+
630+ public C(int a, object c)
631+ {
632+ }
633+
634+ public C(string[] array, int b)
635+ {
636+ }
531637 }
532638 }" ;
533639
0 commit comments