I am trying to test (using Moq) overloaded protected generic method in my code overloaded signatures are:
protected void AutoMap<FromType, ToType>(IList<FromType> sources
, IList<ToType> destinations)
and
protected void AutoMap<FromType, ToType>(FromType from
, ToType to)
To be able to access the second of these methods I am using PrivateObject and then Invoking method through reflection:
a obj_a = new a();
b obj_b = new b();
PrivateObject o = new PrivateObject(controller);
o.Invoke("AutoMap"
, new Type[] { typeof(a), typeof(b) }
, new Object[] { obj_a, obj_b }
, new Type[] { typeof(a), typeof(b) });
When I run the test I got System.Reflection.AmbiguousMatchException saying Ambiguous match found.
Can anyone advise me how to do that correctly ? Cheers K.