Ejemplo n.º 1
0
        public void MethodInjectorCanReturnReferenceType()
        {
            MethodInfo      method   = typeof(MethodInvocationObject).GetMethod("Foo");
            IMethodInjector injector = Factory.GetInjector(method);

            Assert.That(injector, Is.Not.Null);

            MethodInvocationObject mock = new MethodInvocationObject();
            string result = (string)injector.Invoke(mock, new object[] { 42 });

            Assert.That(result, Is.EqualTo("42"));
        }
Ejemplo n.º 2
0
        public void MethodInjectorCanReturnValueType()
        {
            MethodInfo      method   = typeof(MethodInvocationObject).GetMethod("Boink");
            IMethodInjector injector = Factory.GetInjector(method);

            Assert.That(injector, Is.Not.Null);

            MethodInvocationObject mock = new MethodInvocationObject();
            int result = (int)injector.Invoke(mock, new object[] { 12 });

            Assert.That(result, Is.EqualTo(120));
        }