public void Setup() { _invoker = new TestMessageHandlerInvoker <FakeCommand>(); _message = new FakeCommand(123); _messageContext = MessageContext.CreateTest("u.name"); _pipes = new List <IPipe>(); _invocation = new PipeInvocation(_invoker, _message, _messageContext, _pipes); _handlerInvocation = _invocation; }
public void Setup() { _invoker = new TestMessageHandlerInvoker <ExecutableEvent>(); _message = new ExecutableEvent(); _messageContext = MessageContext.CreateTest(); _pipes = new List <IPipe>(); _invocation = new PipeInvocation(_invoker, new List <IMessage> { _message }, _messageContext, _pipes); _handlerInvocation = _invocation; }
private Task <DispatchResult> EnqueueInvocation(ExecutableEvent message) { var tcs = new TaskCompletionSource <DispatchResult>(); var dispatch = new MessageDispatch(MessageContext.CreateTest(), message, (d, r) => tcs.SetResult(r)); dispatch.SetHandlerCount(1); var invoker = new TestMessageHandlerInvoker <ExecutableEvent>(); _dispatchQueue.Enqueue(dispatch, invoker); return(tcs.Task); }
public void should_build_invocation_with_pipe() { var pipe = new FakePipe { IsAutoEnabled = true }; _pipeSource.Pipes.Add(pipe); var message = new FakeCommand(123); var messageContext = MessageContext.CreateTest("u.name"); var invoker = new TestMessageHandlerInvoker(typeof(FakeCommandHandler), typeof(FakeCommand)); var invocation = _pipeManager.BuildPipeInvocation(invoker, message, messageContext); invocation.Pipes.Single().ShouldEqual(pipe); }