public void Can_Publish_to_AnyTestMqAsync_Service() { using (var mqFactory = appHost.TryResolve <IMessageFactory>()) { var request = new AnyTestMqAsync { 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 async Task <object> Any(AnyTestMqAsync request) { return(await Task.Factory.StartNew(() => new AnyTestMqResponse { CorrelationId = request.Id })); }