Example #1
0
        public void InvokeMethodViaReflection_WithoutTypes_IsResult()
        {
            var instance = new TestReflectionClass1();
            var result   = instance.InvokeMethodViaReflection("PublicMethodWithIntParameter", 77);

            Assert.AreEqual(77, result);
        }
Example #2
0
        public void InvokeMethodViaReflection_WithoutTypes_PassesParameters()
        {
            var instance = new TestReflectionClass1();

            instance.InvokeMethodViaReflection("PublicMethodWithIntParameter", 66);
            Assert.AreEqual(66, instance.PublicMethodWithIntParameterData);
        }
Example #3
0
        public void InvokeMethodViaReflection_WithTypes_IsResult()
        {
            var instance = new TestReflectionClass1();
            var result   = instance.InvokeMethodViaReflection("PublicMethodWithIntParameter", new[] { typeof(int) }, new object[] { 45 });

            Assert.AreEqual(45, result);
        }
Example #4
0
        public void InvokeMethodViaReflection_WithoutTypes_CallsMethod()
        {
            var instance = new TestReflectionClass1();

            instance.InvokeMethodViaReflection("PublicParameterlessMethod");
            Assert.IsTrue(instance.PublicParameterlessMethodCalled);
        }
Example #5
0
        public void InvokeMethodViaReflection_WithTypes_PassesParameters()
        {
            var instance = new TestReflectionClass1();

            instance.InvokeMethodViaReflection("PublicMethodWithIntParameter", new[] { typeof(int) }, new object[] { 101 });
            Assert.AreEqual(101, instance.PublicMethodWithIntParameterData);
        }