public static void TestInvokeMethod_IntegerParameterBoxing() { Co1333Invoke clsObj = new Co1333Invoke(); object[] varParams = { 42 }; Assert.Equal("42", (string)getMethod(typeof(Co1333Invoke), "ConvertI4ObjToString").Invoke(clsObj, varParams)); }
public static void TestInvokeMethod_EnumParameterAndEnumReturnValue() { Co1333Invoke clsObj = new Co1333Invoke(); object[] vars = { MyColorEnum.RED }; Assert.Equal(MyColorEnum.GREEN, (MyColorEnum)getMethod(typeof(Co1333Invoke), "GetAndRetMyEnum").Invoke(clsObj, vars)); }
public static void TestInvokeMethod_PrimitiveParameters() { Co1333Invoke clsObj = new Co1333Invoke(); object[] varParams = { 200, 100000 }; Assert.Equal(100200L, (long)getMethod(typeof(Co1333Invoke), "ReturnI8Sum").Invoke(clsObj, varParams)); }
public static void TestInvokeMethod_InheritedStaticOnInstance() { Co1333Invoke clsObj = new Co1333Invoke(); object[] varParams = { 10, }; Assert.Equal(true, (bool)getMethod(typeof(Co1333_a), "IsEvenStatic").Invoke(clsObj, varParams)); }
public static void TestInvokeMethod5() { MethodInfo mi = null; Co1333Invoke clsObj = new Co1333Invoke(); Int64 retVal = 0; Int64 expectedVal = Int64.MaxValue; mi = getMethod(typeof(Co1333Invoke), "ReturnLongMax"); retVal = (Int64)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 TestInvokeMethod4() { MethodInfo mi = null; Co1333Invoke clsObj = new Co1333Invoke(); int retVal = 0; int expectedVal = 3; mi = getMethod(typeof(Co1333Invoke), "Int4ReturnThree"); 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_StaticOnInstanceWithPrimitiveParameters() { Co1333Invoke clsObj = new Co1333Invoke(); object[] varParams = { 10, 100 }; Assert.Equal(110, (int)getMethod(typeof(Co1333Invoke), "ReturnI4Sum").Invoke(clsObj, varParams)); }
public static void TestInvokeMethod3() { MethodInfo mi = null; Co1333Invoke clsObj = new Co1333Invoke(); string retVal = ""; string expectedVal = "42"; Object[] varParams = { (int)42 }; mi = getMethod(typeof(Co1333Invoke), "ConvertI4ObjToString"); retVal = (String)mi.Invoke(clsObj, varParams); Assert.True(retVal.Equals(expectedVal), String.Format("Failed! MethodInfo.Invoke did not return correct result. Expected {0} , Got {1}", expectedVal, retVal)); }
public static void TestInvokeMethod10() { MethodInfo mi = null; Co1333Invoke clsObj = new Co1333Invoke(); int retVal = 0; int expectedVal = (Int32)MyColorEnum.GREEN; Object[] vars = new Object[1]; vars[0] = (MyColorEnum.RED); mi = getMethod(typeof(Co1333Invoke), "GetAndRetMyEnum"); retVal = (int)mi.Invoke(clsObj, vars); Assert.True(retVal.Equals(expectedVal), String.Format("Failed! MethodInfo.Invoke did not return correct result. Expected {0} , Got {1}", expectedVal, retVal)); }
public static void TestInvokeMethod9() { MethodInfo mi = null; Co1333Invoke clsObj = new Co1333Invoke(); bool retVal = false; bool expectedVal = true; Object[] varParams = { (10), }; mi = getMethod(typeof(Co1333_a), "IsEvenStatic"); retVal = (bool)mi.Invoke(clsObj, varParams); Assert.True(retVal.Equals(expectedVal), String.Format("Failed! MethodInfo.Invoke did not return correct result. Expected {0} , Got {1}", expectedVal, retVal)); }
public static void TestInvokeMethod8() { MethodInfo mi = null; Co1333Invoke clsObj = new Co1333Invoke(); int retVal = 0; int expectedVal = 110; Object[] varParams = { (10), (100) }; mi = getMethod(typeof(Co1333Invoke), "ReturnI4Sum"); retVal = (int)mi.Invoke(clsObj, varParams); Assert.True(retVal.Equals(expectedVal), String.Format("Failed! MethodInfo.Invoke did not return correct result. Expected {0} , Got {1}", expectedVal, retVal)); }
public static void TestInvokeMethod9() { MethodInfo mi = null; Co1333Invoke clsObj = new Co1333Invoke(); bool retVal = false; bool expectedVal = true; Object[] varParams = { ( 10 ), }; mi = getMethod(typeof(Co1333_a), "IsEvenStatic"); retVal = (bool)mi.Invoke(clsObj, varParams); Assert.True(retVal.Equals(expectedVal), String.Format("Failed! MethodInfo.Invoke did not return correct result. Expected {0} , Got {1}", expectedVal, retVal)); }
public static void TestInvokeMethod8() { MethodInfo mi = null; Co1333Invoke clsObj = new Co1333Invoke(); int retVal = 0; int expectedVal = 110; Object[] varParams = { ( 10 ), ( 100 ) }; mi = getMethod(typeof(Co1333Invoke), "ReturnI4Sum"); retVal = (int)mi.Invoke(clsObj, varParams); 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_NoParametersInt64Return() { Co1333Invoke clsObj = new Co1333Invoke(); Assert.Equal(Int64.MaxValue, (Int64)getMethod(typeof(Co1333Invoke), "ReturnLongMax").Invoke(clsObj, null)); }
public static void TestInvokeMethod_NoParametersInt4Return() { Co1333Invoke clsObj = new Co1333Invoke(); Assert.Equal(3, (int)getMethod(typeof(Co1333Invoke), "Int4ReturnThree").Invoke(clsObj, null)); }