Beispiel #1
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"]);
        }
Beispiel #2
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"]);
        }
Beispiel #3
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);
        }
Beispiel #4
0
 public void ShouldBeCreatable()
 {
     MethodBase        methodInfo = GetTargetMethodInfo("FirstTarget");
     InvocationTarget  target     = new InvocationTarget();
     IMethodInvocation invocation = GetInvocation(methodInfo, target);
 }
Beispiel #5
0
        private IMethodInvocation GetInvocation(MethodBase methodInfo, InvocationTarget target)
        {
            IMethodCallMessage remotingMessage = new FakeMethodCallMessage(methodInfo, new object[] { 1, "two" });

            return(new RemotingMethodInvocation(remotingMessage, target));
        }