public static void TestInvokeMethod12() { MethodInfo mi = null; MyClass clsObj = new MyClass(); int retVal = 0; int expectedVal = 20; mi = getMethod(typeof(MyInterface), "IMethodNew"); retVal = (int)mi.Invoke(clsObj, new object[] { }); 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_InterfaceMethodMarkedAsNew() { MyClass clsObj = new MyClass(); Assert.Equal(20, (int)getMethod(typeof(MyInterface), "IMethodNew").Invoke(clsObj, new object[] { })); }