Example #1
0
 public override Response Handle(RequestX request)
 {
     return(CreateTypedResponse());
 }
        public void TestAutoConnectAfterStartRespondingTo()
        {
            DeleteQueues();
            try
            {
                var requestX = new RequestX(RequesterId.New(), RequestId.New());

                using (var requestBus = DependencyResolver.Get<IRequestBus>())
                {
                    using (var responseBus = DependencyResolver.Get<IResponseBus>())
                    {
                        responseBus.StartRespondingTo<RequestX, ResponseX>(r => new ResponseX(ResponderId.New(), ResponseId.New(), r));

                        RestartMessageBrokerToForceConnectionToBeLost();

                        var receivedResponse = requestBus.Request<RequestX, ResponseX>(requestX);

                        receivedResponse.Should().NotBeNull("A response must be received for the sent request!");
                        receivedResponse.Request.RequestId.Should().Be(requestX.RequestId, "The request associated with the received response must be the sent request!");
                    }
                }
            }
            finally
            {
                DeleteQueues();
            }
        }