public void Setup()
 {
     _invoker        = new TestAsyncMessageHandlerInvoker <ExecutableEvent>();
     _message        = new ExecutableEvent();
     _messageContext = MessageContext.CreateTest();
     _pipes          = new List <IPipe>();
     _invocation     = new PipeInvocation(_invoker, new List <IMessage> {
         _message
     }, _messageContext, _pipes);
 }
        private Task <DispatchResult> EnqueueAsyncInvocation(AsyncExecutableEvent message)
        {
            var tcs = new TaskCompletionSource <DispatchResult>();

            var dispatch = new MessageDispatch(MessageContext.CreateTest(), message, (d, r) => tcs.SetResult(r));

            dispatch.SetHandlerCount(1);

            var invoker = new TestAsyncMessageHandlerInvoker <AsyncExecutableEvent>();

            _dispatchQueue.Enqueue(dispatch, invoker);

            return(tcs.Task);
        }