public void Can_Publish_to_AnyTestMq_Service()
 {
     using (var mqFactory = appHost.TryResolve <IMessageFactory>())
     {
         var request = new AnyTestMq {
             Id = 1
         };
         mqFactory.CreateMessageProducer().Publish(request);
         var msg = mqFactory.CreateMessageQueueClient().Get(QueueNames <AnyTestMqResponse> .In, null)
                   .ToMessage <AnyTestMqResponse>();
         Assert.That(msg.GetBody().CorrelationId, Is.EqualTo(request.Id));
     }
 }
        public void SendOneWay_calls_AnyTestMq_Service_via_MQ()
        {
            var client  = new JsonServiceClient(BaseUri);
            var request = new AnyTestMq {
                Id = 3
            };

            client.SendOneWay(request);

            using (var mqFactory = appHost.TryResolve <IMessageFactory>())
            {
                var msg = mqFactory.CreateMessageQueueClient().Get(QueueNames <AnyTestMqResponse> .In, null)
                          .ToMessage <AnyTestMqResponse>();
                Assert.That(msg.GetBody().CorrelationId, Is.EqualTo(request.Id));
            }
        }
        public void Can_Publish_to_AnyTestMq_Service()
        {
            using (var mqFactory = appHost.TryResolve<IMessageFactory>())
            {
                var request = new AnyTestMq { Id = 1 };

                using (var mqProducer = mqFactory.CreateMessageProducer())
                    mqProducer.Publish(request);

                using (var mqClient = mqFactory.CreateMessageQueueClient())
                {
                    var msg = mqClient.Get<AnyTestMqResponse>(QueueNames<AnyTestMqResponse>.In, null);
                    mqClient.Ack(msg);
                    Assert.That(msg.GetBody().CorrelationId, Is.EqualTo(request.Id));
                }
            }
        }
        public void Can_Publish_to_AnyTestMq_Service()
        {
            using (var mqFactory = AppHost.TryResolve <IMessageFactory>())
            {
                var request = new AnyTestMq {
                    Id = 1
                };

                using (var mqProducer = mqFactory.CreateMessageProducer())
                    mqProducer.Publish(request);

                using (var mqClient = mqFactory.CreateMessageQueueClient())
                {
                    var msg = mqClient.Get <AnyTestMqResponse>(QueueNames <AnyTestMqResponse> .In, MessageTimeout);
                    mqClient.Ack(msg);
                    Assert.That(msg.GetBody().CorrelationId, Is.EqualTo(request.Id));
                }
            }
        }
 public object Any(AnyTestMq request)
 {
     return(new AnyTestMqResponse {
         CorrelationId = request.Id
     });
 }
示例#6
0
 public object Any(AnyTestMq request)
 {
     return new AnyTestMqResponse { CorrelationId = request.Id };
 }
示例#7
0
        public void SendOneWay_calls_AnyTestMq_Service_via_MQ()
        {
            var client = new JsonServiceClient(BaseUri);
            var request = new AnyTestMq { Id = 3 };

            client.SendOneWay(request);

            using (var mqFactory = appHost.TryResolve<IMessageFactory>())
            {
                var msg = mqFactory.CreateMessageQueueClient().Get(QueueNames<AnyTestMqResponse>.In, null)
                    .ToMessage<AnyTestMqResponse>();
                Assert.That(msg.GetBody().CorrelationId, Is.EqualTo(request.Id));
            }
        }