public MessagePumpRetryEventConnectionFailureTests()
        {
            _commandProcessor = new SpyCommandProcessor();
            var channel = new FailingChannel {
                NumberOfRetries = 1
            };
            var mapper = new MyEventMessageMapper();

            _messagePump = new MessagePump <MyEvent>(_commandProcessor, mapper)
            {
                Channel = channel, TimeoutInMilliseconds = 500, RequeueCount = -1
            };

            var @event = new MyEvent();

            //Two events will be received when channel fixed
            var message1 = new Message(new MessageHeader(Guid.NewGuid(), "MyTopic", MessageType.MT_EVENT), new MessageBody(JsonConvert.SerializeObject(@event)));
            var message2 = new Message(new MessageHeader(Guid.NewGuid(), "MyTopic", MessageType.MT_EVENT), new MessageBody(JsonConvert.SerializeObject(@event)));

            channel.Enqueue(message1);
            channel.Enqueue(message2);

            //Quit the message pump
            var quitMessage = new Message(new MessageHeader(Guid.Empty, "", MessageType.MT_QUIT), new MessageBody(""));

            channel.Enqueue(quitMessage);
        }
        public MessagePumpRetryCommandOnConnectionFailureTests()
        {
            _commandProcessor = new SpyCommandProcessor();
            var channel = new FailingChannel {
                NumberOfRetries = 1
            };
            var mapper = new MyCommandMessageMapper();

            _messagePump = new MessagePump <MyCommand>(_commandProcessor, mapper)
            {
                Channel = channel, TimeoutInMilliseconds = 500, RequeueCount = -1
            };

            var command = new MyCommand();

            //two command, will be received when connection restored
            var message1 = new Message(new MessageHeader(Guid.NewGuid(), "MyTopic", MessageType.MT_COMMAND), new MessageBody(JsonConvert.SerializeObject(command)));
            var message2 = new Message(new MessageHeader(Guid.NewGuid(), "MyTopic", MessageType.MT_COMMAND), new MessageBody(JsonConvert.SerializeObject(command)));

            channel.Enqueue(message1);
            channel.Enqueue(message2);

            //end the pump
            var quitMessage = new Message(new MessageHeader(Guid.Empty, "", MessageType.MT_QUIT), new MessageBody(""));

            channel.Enqueue(quitMessage);
        }