public void one_subscriber_connects_to_one_publisher_receives_message_then_second_subscriber_connects_both_receive_message(RedFoxTransport transport) { using (var publisher = new Publisher()) using (var subscriber1 = new TestSubscriber()) using (var subscriber2 = new TestSubscriber()) { var endpoint = TestHelpers.CreateEndpointForTransport(transport); publisher.Bind(endpoint); subscriber1.Connect(endpoint); Thread.Sleep(100); var broadcastMessage = new TestMessage { Text = "Hello" }; publisher.Broadcast(broadcastMessage); Assert.AreEqual(broadcastMessage, subscriber1.TestMustReceiveMessageWithin(Timeout)); subscriber2.Connect(endpoint); Thread.Sleep(100); publisher.Broadcast(broadcastMessage); Assert.AreEqual(broadcastMessage, subscriber1.TestMustReceiveMessageWithin(Timeout)); Assert.AreEqual(broadcastMessage, subscriber2.TestMustReceiveMessageWithin(Timeout)); } }
public void Subscribe_to_Publisher_receive_two_single_broadcasted_messages(RedFoxTransport transport) { using (var publisher = new Publisher()) using (var subscriber = new TestSubscriber()) { var endpoint = TestHelpers.CreateEndpointForTransport(transport); publisher.Bind(endpoint); subscriber.Connect(endpoint); Thread.Sleep(100); var broadcastedMessage = new TestMessage { Text = "Hello" }; publisher.Broadcast(broadcastedMessage); publisher.Broadcast(broadcastedMessage); Assert.AreEqual(broadcastedMessage, subscriber.TestMustReceiveMessageWithin(Timeout)); Assert.AreEqual(broadcastedMessage, subscriber.TestMustReceiveMessageWithin(Timeout)); } }
public void Subscribe_to_Publisher_receive_single_broadcasted_message(RedFoxTransport transport) { using (var publisher = new Publisher()) using (var subscriber = new TestSubscriber()) { var endpoint = TestHelpers.CreateEndpointForTransport(transport); publisher.Bind(endpoint); subscriber.Connect(endpoint); Thread.Sleep(100); var broadcastedMessage = new TestMessage { Text = "Hello" }; publisher.Broadcast(broadcastedMessage); Assert.AreEqual(broadcastedMessage, subscriber.TestMustReceiveMessageWithin(Timeout)); } }
public void one_subscriber_connects_to_one_publisher_receives_message_then_second_subscriber_connects_both_receive_message(RedFoxTransport transport) { using (var publisher = new Publisher()) using (var subscriber1 = new TestSubscriber()) using (var subscriber2 = new TestSubscriber()) { var endpoint = TestHelpers.CreateEndpointForTransport(transport); publisher.Bind(endpoint); subscriber1.Connect(endpoint); Thread.Sleep(100); var broadcastMessage = new TestMessage { Text = "Hello" }; publisher.Broadcast(broadcastMessage); Assert.AreEqual(broadcastMessage, subscriber1.TestMustReceiveMessageWithin(Timeout)); subscriber2.Connect(endpoint); Thread.Sleep(100); publisher.Broadcast(broadcastMessage); Assert.AreEqual(broadcastMessage, subscriber1.TestMustReceiveMessageWithin(Timeout)); Assert.AreEqual(broadcastMessage, subscriber2.TestMustReceiveMessageWithin(Timeout)); } }