public static void TestInvokeMethod1() { MethodInfo mi = null; Co1333_b clsObj = new Co1333_b(); int retVal = -1; int expectedVal = 0; mi = getMethod(typeof(Co1333_b), "ReturnTheIntPlus"); retVal = (int)mi.Invoke(clsObj, (Object[])null); Assert.True(retVal.Equals(expectedVal), String.Format("Failed! MethodInfo.Invoke did not return correct result. Expected {0} , Got {1}", expectedVal, retVal)); }
public static void TestInvokeMethod_ExactMethodWithInheritance() { Co1333_b clsObj = new Co1333_b(); Assert.Equal(0, (int)getMethod(typeof(Co1333_b), "ReturnTheIntPlus").Invoke(clsObj, null)); }