public void Should_property_adapt_itself_to_a_channel_network() { TraceLogger.Configure(LogLevel.Debug); ILogger log = Logger.GetLogger<Sending_a_message_through_a_wcf_channel>(); log.Debug("Starting"); var serviceUri = new Uri("net.pipe://localhost/Pipe"); string pipeName = "Test"; Channel<TestMessage> adapter = new ChannelAdapter<TestMessage>(); using (var host = new WcfChannelHost<TestMessage>(adapter, serviceUri, pipeName)) { log.Debug("Host started"); var future = new Future<TestMessage>(); using (adapter.Connect(x => { x.AddConsumer(m => { log.Debug(l => l.Write("Received: {0}", m.Value)); future.Complete(m); }); })) { var client = new WcfChannelProxy<TestMessage>(new SynchronousFiber(), serviceUri, pipeName); log.Debug("Client started"); client.Send(new TestMessage("Hello!")); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); log.Debug("Complete"); } } }
public void Should_properly_arrive_at_the_destination() { var serviceUri = new Uri("net.pipe://localhost/pipe"); string pipeName = "test"; var future = new Future <TestMessage>(); var message = new TestMessage { Id = Guid.NewGuid(), Name = "Alpha", }; UntypedChannel adapter = new ChannelAdapter(); using (var remote = new WcfChannelHost(new SynchronousFiber(), adapter, serviceUri, pipeName)) { using (adapter.Connect(x => { x.AddConsumerOf <TestMessage>() .UsingConsumer(m => future.Complete(m)); })) { var client = new WcfChannelProxy(new SynchronousFiber(), serviceUri, pipeName); client.Send(message); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); } } future.Value.ShouldNotBeNull(); future.Value.ShouldEqual(message); future.Value.ShouldNotBeTheSameAs(message); }
public void Should_properly_arrive_at_the_destination() { var serviceUri = new Uri("net.pipe://localhost/pipe"); string pipeName = "test"; var future = new Future<TestMessage>(); var message = new TestMessage { Id = Guid.NewGuid(), Name = "Alpha", }; UntypedChannel adapter = new ChannelAdapter(); using (var remote = new WcfChannelHost(new SynchronousFiber(), adapter, serviceUri, pipeName)) { using (adapter.Connect(x => { x.AddConsumerOf<TestMessage>() .UsingConsumer(m => future.Complete(m)); })) { var client = new WcfChannelProxy(new SynchronousFiber(), serviceUri, pipeName); client.Send(message); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); } } future.Value.ShouldNotBeNull(); future.Value.ShouldEqual(message); future.Value.ShouldNotBeTheSameAs(message); }
public void Should_properly_arrive_at_the_destination() { TraceLogger.Configure(LogLevel.Debug); _log = Logger.GetLogger <Sending_a_message_to_a_remote_channel_via_wcf>(); _log.Debug("Starting"); var serviceUri = new Uri("net.pipe://localhost/pipe"); string pipeName = "test"; var future = new Future <TestMessage>(); var message = new TestMessage { Id = Guid.NewGuid(), Name = "Alpha", }; UntypedChannel adapter = new ChannelAdapter(); using (var remote = new WcfChannelHost(new SynchronousFiber(), adapter, serviceUri, pipeName)) { _log.Debug("Remote channel adapter created"); using (adapter.Connect(x => { x.AddConsumerOf <TestMessage>() .UsingConsumer(m => future.Complete(m)); })) { var client = new WcfChannelProxy(new SynchronousFiber(), serviceUri, pipeName); _log.Debug("Client created"); client.Send(message); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); } } future.Value.ShouldNotBeNull(); future.Value.ShouldEqual(message); future.Value.ShouldNotBeTheSameAs(message); }
public void Should_property_adapt_itself_to_a_channel_network() { var serviceUri = new Uri("net.pipe://localhost/Pipe"); string pipeName = "Test"; Channel<TestMessage> adapter = new ChannelAdapter<TestMessage>(); using (var host = new WcfChannelHost<TestMessage>(adapter, serviceUri, pipeName)) { var future = new Future<TestMessage>(); using (adapter.Connect(x => { x.AddConsumer(future.Complete); })) { var client = new WcfChannelProxy<TestMessage>(new SynchronousFiber(), serviceUri, pipeName); client.Send(new TestMessage("Hello!")); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); } } }
public void Should_property_adapt_itself_to_a_channel_network() { TraceLogger.Configure(LogLevel.Debug); ILogger log = Logger.GetLogger <Sending_a_message_through_a_wcf_channel>(); log.Debug("Starting"); var serviceUri = new Uri("net.pipe://localhost/Pipe"); string pipeName = "Test"; Channel <TestMessage> adapter = new ChannelAdapter <TestMessage>(); using (var host = new WcfChannelHost <TestMessage>(adapter, serviceUri, pipeName)) { log.Debug("Host started"); var future = new Future <TestMessage>(); using (adapter.Connect(x => { x.AddConsumer(m => { log.Debug(l => l.Write("Received: {0}", m.Value)); future.Complete(m); }); })) { var client = new WcfChannelProxy <TestMessage>(new SynchronousFiber(), serviceUri, pipeName); log.Debug("Client started"); client.Send(new TestMessage("Hello!")); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); log.Debug("Complete"); } } }
public void Should_property_adapt_itself_to_a_channel_network() { var serviceUri = new Uri("net.pipe://localhost/Pipe"); string pipeName = "Test"; Channel <TestMessage> adapter = new ChannelAdapter <TestMessage>(); using (var host = new WcfChannelHost <TestMessage>(adapter, serviceUri, pipeName)) { var future = new Future <TestMessage>(); using (adapter.Connect(x => { x.AddConsumer(future.Complete) .HandleOnCallingThread(); })) { var client = new WcfChannelProxy <TestMessage>(new SynchronousFiber(), serviceUri, pipeName); client.Send(new TestMessage("Hello!")); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); } } }
public void Should_properly_arrive_at_the_destination() { TraceLogProvider.Configure(LogLevel.Debug); _log = Logger.GetLogger<Sending_a_message_to_a_remote_channel_via_wcf>(); _log.Debug("Starting"); var serviceUri = new Uri("net.pipe://localhost/pipe"); string pipeName = "test"; var future = new Future<TestMessage>(); var message = new TestMessage { Id = Guid.NewGuid(), Name = "Alpha", }; UntypedChannel adapter = new ChannelAdapter(); using (var remote = new WcfChannelHost(new SynchronousFiber(), adapter, serviceUri, pipeName)) { _log.Debug("Remote channel adapter created"); using (adapter.Connect(x => { x.AddConsumerOf<TestMessage>() .UsingConsumer(m => future.Complete(m)); })) { var client = new WcfChannelProxy(new SynchronousFiber(), serviceUri, pipeName); _log.Debug("Client created"); client.Send(message); future.WaitUntilCompleted(2.Seconds()).ShouldBeTrue(); } } future.Value.ShouldNotBeNull(); future.Value.ShouldEqual(message); future.Value.ShouldNotBeTheSameAs(message); }