public void PrivateInstance_InferredName() { PrivateInstance dg = null; TestClass instance = new TestClass(THE_NAME); // Partially generic overload dg = MR.GetMethodCaller <PrivateInstance>(instance, typeof(TestClass)); XAssert.NotNull(dg); }
public void ProtectedStatic_InferredName() { ProtectedStatic dg = null; // Fully generic overload dg = MR.GetMethodCaller <TestClass, ProtectedStatic>(); XAssert.NotNull(dg); // Partially generic overload dg = MR.GetMethodCaller <ProtectedStatic>(typeof(TestClass)); XAssert.NotNull(dg); }
public void ProtectedStatic_OutParam() { // Signature with out param should not match signature with ref param XAssert.Throws <MissingMethodException>(() => MR.GetMethodCaller <ProtectedStatic_inrefint>(typeof(TestClass), "ProtectedStatic")); var dg = MR.GetMethodCaller <ProtectedStatic_inoutint>(typeof(TestClass), "ProtectedStatic"); XAssert.NotNull(dg); int val = 0; dg(21, out val); XAssert.Equal(42, val); }
public void PrivateStatic_InferredName() { PrivateStatic dg = null; // Fully generic overload dg = MR.GetMethodCaller <TestClass, PrivateStatic>(); XAssert.NotNull(dg); XAssert.Equal(TestClass.StringConstant, dg()); // Partially generic overload dg = MR.GetMethodCaller <PrivateStatic>(typeof(TestClass)); XAssert.NotNull(dg); XAssert.Equal(TestClass.StringConstant, dg()); }
public void ProtectedStatic_ExplicitName() { ProtectedStatic_string dg = null; // Case-sensitive name dg = MR.GetMethodCaller <ProtectedStatic_string>(typeof(TestClass), "ProtectedStatic"); XAssert.NotNull(dg); // Case-sensitive name - should fail XAssert.Throws <MissingMethodException>(() => MR.GetMethodCaller <ProtectedStatic_string>(typeof(TestClass), "protectedstatic")); // Case-insensitive name dg = MR.GetMethodCaller <ProtectedStatic_string>(typeof(TestClass), "protectedstatic", true); XAssert.NotNull(dg); }
public void PrivateInstance_ExplicitName() { PrivateInstance_int dg = null; TestClass instance = new TestClass(THE_NAME); // Case-sensitive name dg = MR.GetMethodCaller <PrivateInstance_int>(instance, typeof(TestClass), "PrivateInstance"); XAssert.NotNull(dg); // Case-sensitive name - should fail XAssert.Throws <MissingMethodException>(() => MR.GetMethodCaller <PrivateInstance_int>(instance, typeof(TestClass), "privateinstance")); // Case-insensitive name dg = MR.GetMethodCaller <PrivateInstance_int>(instance, typeof(TestClass), "privateinstance", true); XAssert.NotNull(dg); }
public void PrivateStatic_ExplicitName() { PrivateStatic_int dg = null; string lConst3 = TestClass.StringConstant + TestClass.StringConstant + TestClass.StringConstant; // Case-sensitive name dg = MR.GetMethodCaller <PrivateStatic_int>(typeof(TestClass), "PrivateStatic"); XAssert.NotNull(dg); XAssert.Equal(lConst3, dg(3)); // Case-sensitive name - should fail XAssert.Throws <MissingMethodException>(() => MR.GetMethodCaller <PrivateStatic_int>(typeof(TestClass), "privatestatic")); // Case-insensitive name dg = MR.GetMethodCaller <PrivateStatic_int>(typeof(TestClass), "privatestatic", true); XAssert.NotNull(dg); XAssert.Equal(lConst3, dg(3)); }
public void ProtectedInstance_ExplicitName() { ProtectedInstance_int dg = null; TestClass instance = new TestClass(THE_NAME); string lExpected = THE_NAME + TestClass.StringConstant + TestClass.StringConstant + TestClass.StringConstant; // Case-sensitive name dg = MR.GetMethodCaller <ProtectedInstance_int>(instance, typeof(TestClass), "ProtectedInstance"); XAssert.NotNull(dg); XAssert.Equal(lExpected, dg(3)); // Case-sensitive name - should fail XAssert.Throws <MissingMethodException>(() => MR.GetMethodCaller <ProtectedInstance_int>(typeof(TestClass), "protectedinstance")); // Case-insensitive name dg = MR.GetMethodCaller <ProtectedInstance_int>(instance, typeof(TestClass), "protectedinstance", true); XAssert.NotNull(dg); XAssert.Equal(lExpected, dg(3)); }