public static void TestInvokeMethod2() { MethodInfo mi = null; Co1333_b clsObj = new Co1333_b1(); int retVal = -1; int expectedVal = 1; 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_MethodFromParentClass() { Co1333_b clsObj = new Co1333_b1(); Assert.Equal(1, (int)getMethod(typeof(Co1333_b), "ReturnTheIntPlus").Invoke(clsObj, null)); }