Exemplo n.º 1
0
        private IMethodInvocation GetInvocation(MethodBase methodInfo,
                                                InvocationTarget target)
        {
            IMethodCallMessage remotingMessage = new FakeMethodCallMessage(methodInfo, new object[] { 1, "two" });

            return(new TransparentProxyMethodInvocation(remotingMessage, target));
        }
Exemplo n.º 2
0
        public void ShouldBeAbleToChangeInputs()
        {
            MethodBase        methodInfo = GetTargetMethodInfo("FirstTarget");
            InvocationTarget  target     = new InvocationTarget();
            IMethodInvocation invocation = GetInvocation(methodInfo, target);

            Assert.AreEqual(1, invocation.Inputs["one"]);
            invocation.Inputs["one"] = 42;
            Assert.AreEqual(42, invocation.Inputs["one"]);
        }
Exemplo n.º 3
0
        public void ShouldBeAbleToAddToContext()
        {
            MethodBase        methodInfo = GetTargetMethodInfo("FirstTarget");
            InvocationTarget  target     = new InvocationTarget();
            IMethodInvocation invocation = GetInvocation(methodInfo, target);

            invocation.InvocationContext["firstItem"]  = 1;
            invocation.InvocationContext["secondItem"] = "hooray!";

            Assert.AreEqual(2, invocation.InvocationContext.Count);
            Assert.AreEqual(1, invocation.InvocationContext["firstItem"]);
            Assert.AreEqual("hooray!", invocation.InvocationContext["secondItem"]);
        }
Exemplo n.º 4
0
        public void ShouldMapInputsCorrectly()
        {
            MethodBase        methodInfo = GetTargetMethodInfo("FirstTarget");
            InvocationTarget  target     = new InvocationTarget();
            IMethodInvocation invocation = GetInvocation(methodInfo, target);

            Assert.AreEqual(2, invocation.Inputs.Count);
            Assert.AreEqual(1, invocation.Inputs[0]);
            Assert.AreEqual("two", invocation.Inputs[1]);
            Assert.AreEqual("two", invocation.Inputs["two"]);
            Assert.AreEqual(1, invocation.Inputs["one"]);
            Assert.AreEqual(methodInfo, invocation.MethodBase);
            Assert.AreSame(target, invocation.Target);
        }
Exemplo n.º 5
0
 public void ShouldBeCreatable()
 {
     MethodBase        methodInfo = GetTargetMethodInfo("FirstTarget");
     InvocationTarget  target     = new InvocationTarget();
     IMethodInvocation invocation = GetInvocation(methodInfo, target);
 }