Пример #1
0
        public void CallMethod()
        {
            CallMethodTestClass testClass = new CallMethodTestClass();

            Assert.AreEqual(testClass.PublicMethodWithNoParameters(), ReflectionHelper.CallMethod(testClass, "PublicMethodWithNoParameters"));
            Assert.AreEqual(testClass.PublicMethodWithParameters(5), ReflectionHelper.CallMethod(testClass, "PublicMethodWithParameters", 5));
            Assert.AreEqual(testClass.PublicMethodWithParameters(5, 20L), ReflectionHelper.CallMethod(testClass, "PublicMethodWithParameters", 5, 20L));
        }
Пример #2
0
        public void CallMethod()
        {
            CallMethodTestClass testClass = new CallMethodTestClass();

            Assert.AreEqual(testClass.PublicMethodWithNoParameters(), ExpressionHelper.CallMethod(testClass, "PublicMethodWithNoParameters"));
            Assert.AreEqual(testClass.PublicMethodWithParameters(5), ExpressionHelper.CallMethod(testClass, "PublicMethodWithParameters", 5));
            Assert.AreEqual(testClass.PublicMethodWithParameters(5, 20L), ExpressionHelper.CallMethod(testClass, "PublicMethodWithParameters", 5, 20L));
            Assert.DoesNotThrow(() => ExpressionHelper.CallMethod(testClass, "PublicVoidMethodWithNoParameters"));
        }