public void Test_ArgumentsMatch_InvalidType() { EntityOne e = new EntityOne(); e.ID = Guid.NewGuid(); MethodInfo method = e.GetType().GetMethod("DoSomething"); MethodInfo cMethod = method.MakeGenericMethod(typeof(IEntity)); Type[] expectedArguments = new Type[] { typeof(string) }; Type[] arguments = cMethod.GetGenericArguments(); bool match = Reflector.ArgumentsMatch(cMethod, expectedArguments); Assert.IsFalse(match); }
public void Test_ArgumentsMatch_Assignable() { EntityOne e = new EntityOne(); e.ID = Guid.NewGuid(); Type[] typeArguments = new Type[] { typeof(IEntity) }; MethodInfo method = e.GetType().GetMethod("DoSomething"); MethodInfo cMethod = method.MakeGenericMethod(typeArguments); Type[] expectedArguments = new Type[] { typeof(EntityTwo) }; bool match = Reflector.ArgumentsMatch(cMethod, expectedArguments); Assert.IsTrue(match); }