public void Can_Dispatch_Raw_Messages_To_Pass_Through_Endpoint() { PassThroughService pts = new PassThroughService(); ServiceHost host = new ServiceHost(pts); host.Open(); WcfProxyDispatcher contractDispatcher = new WcfProxyDispatcher(); SubscriptionEndpoint endpoint = new SubscriptionEndpoint(Guid.NewGuid(), "test", "PassThroughClient", "net.pipe://localhost/passthrough", typeof(IPassThroughServiceContract), contractDispatcher, new PassThroughMessageFilter()); string action = "http://someaction"; string body = "this is a test"; pts.Validator = (msg) => { Assert.AreEqual(msg.Headers.Action, action); Assert.AreEqual(msg.GetBody<string>(), body); }; Message message = Message.CreateMessage(MessageVersion.Default, action, body); using (ServiceBusRuntime runtime = new ServiceBusRuntime(new DirectDeliveryCore())) { runtime.Subscribe(endpoint); runtime.Start(); contractDispatcher.Dispatch(new MessageDelivery(endpoint.Id, typeof(IPassThroughServiceContract), action, message, 3, new MessageDeliveryContext())); runtime.Stop(); } Assert.AreEqual(1, pts.PublishedCount); host.Close(); }
public void Can_Dispatch_Raw_Messages_To_Pass_Through_Endpoint() { PassThroughService pts = new PassThroughService(); ServiceHost host = new ServiceHost(pts); host.Open(); WcfProxyDispatcher contractDispatcher = new WcfProxyDispatcher(); SubscriptionEndpoint endpoint = new SubscriptionEndpoint(Guid.NewGuid(), "test", "PassThroughClient", "net.pipe://localhost/passthrough", typeof(IPassThroughServiceContract), contractDispatcher, new PassThroughMessageFilter()); string action = "http://someaction"; string body = "this is a test"; pts.Validator = (msg) => { Assert.AreEqual(msg.Headers.Action, action); Assert.AreEqual(msg.GetBody <string>(), body); }; Message message = Message.CreateMessage(MessageVersion.Default, action, body); using (ServiceBusRuntime runtime = new ServiceBusRuntime(new DirectDeliveryCore())) { runtime.Subscribe(endpoint); runtime.Start(); contractDispatcher.Dispatch(new MessageDelivery(endpoint.Id, typeof(IPassThroughServiceContract), action, message, 3, new MessageDeliveryContext())); runtime.Stop(); } Assert.AreEqual(1, pts.PublishedCount); host.Close(); }