Here is a small update:
I added another method to
DifferentMethods with the same parameters in another order:
public void MethodThreeParams3(DateTime a, IList<MyItem> b, byte c)
{
}
and call only 2 methods
Methods.MethodThreeParams(1, DateTime.Today, list);
Methods.MethodThreeParams3(DateTime.Today, list, 6);
in
UnderTest and expect them with CustomChecker:
Isolate.WhenCalled((IList<MyItem> list) => methodsFake.MethodThreeParams(1, DateTime.Today, list))
.AndArgumentsMatch((list) =>
{
return true;//list.Count == 2;
})
.WithExactArguments()
.IgnoreCall();
Isolate.WhenCalled((IList<MyItem> list) => methodsFake.MethodThreeParams3(DateTime.Today, list, 6))
.AndArgumentsMatch((list) =>
{
return true;//list.Count == 2;
})
.WithExactArguments()
.IgnoreCall();
Now I get another exception:
TestCase 'UnderTestUnitTests.UnderTestTest.TestMeTest'
failed: System.ArgumentException: Object of type 'System.DateTime' cannot be converted to type 'System.Collections.Generic.IList`1[PlayingWithAAA.MyItem]'.
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at ca.f(Object[] A_0)
at ca.b(Object[] A_0, Type A_1)
at c3.c(Object[] A_0, Type A_1)
at c3.a(Object[] A_0, Type A_1)
at c3.b(Object[] A_0, Type A_1)
at ad.a(Object A_0, Object[] A_1, Type A_2, Scope A_3, Int32 A_4, Object A_5, Type A_6)
at bh.a(String A_0, Object[] A_1, Object A_2, Object A_3, String A_4, Type A_5)
at b4.a(String A_0, Object A_1, MethodBase A_2, Object[] A_3, Object A_4, String A_5, bh A_6)
at b4.b(Object A_0, String A_1, String A_2, MethodBase A_3, Object[] A_4, Object A_5)
...: at PlayingWithAAA.DifferentMethods.MethodThreeParams(Int32 a, DateTime b, IList`1 c)
However, I can call the same method several times and expectations work fine. For me it seems like Isolator gets confused in different methods' signatures.