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