public void Test_IsMultipleReference_False() { EntityOne e1 = new EntityOne(); PropertyInfo property = e1.GetType().GetProperty("SingleReferenceProperty"); Assert.IsFalse(EntitiesUtilities.IsMultipleReference(e1.GetType(), property), "Returned true when it should have returned false."); }
public void Test_GetMirrorPropertyName_Single_Implicit_Sync() { EntityOne e1 = new EntityOne(); string mirrorPropertyName = EntitiesUtilities.GetMirrorPropertyName(e1, e1.GetType().GetProperty("SingleReferenceProperty")); Assert.AreEqual(String.Empty, mirrorPropertyName, "The mirror property name wasn't determined correctly."); }
public void Test_ParametersMatch_InvalidCount() { EntityOne e = new EntityOne(); e.ID = Guid.NewGuid(); MethodInfo method = e.GetType().GetMethod("DoSomething"); Type[] expectedParameters = new Type[] {}; bool match = Reflector.ParametersMatch(method, method.GetGenericArguments(), expectedParameters); Assert.IsFalse(match); }
public void Test_ParametersMatch() { EntityOne e = new EntityOne(); e.ID = Guid.NewGuid(); MethodInfo method = e.GetType().GetMethod("DoSomething"); MethodInfo cMethod = method.MakeGenericMethod(typeof(IEntity)); Type[] expectedParameters = new Type[] { typeof(IEntity) }; bool match = Reflector.ParametersMatch(cMethod, cMethod.GetGenericArguments(), expectedParameters); Assert.IsTrue(match); }
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_Direct() { 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(IEntity)}; bool match = Reflector.ArgumentsMatch(cMethod, expectedArguments); Assert.IsTrue(match); }
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); }
public void Test_ParametersMatch_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[] expectedParameters = new Type[] {typeof(EntityTwo)}; bool match = Reflector.ParametersMatch(cMethod, typeArguments, expectedParameters); Assert.IsTrue(match); }