public void TestReceiveMessageFromSingleSender( ) { var sender = new TestSender( ); using (var receiver = new TestReceiver( )) { receiver.SubscribeToMessagesFrom(sender); sender.SendMessage(MessageLevel.INFO, "This is a test."); Assert.That(receiver.MessageReceived, Is.True); } }
public void TestReceiveMessageFromMultipleSenders( ) { var aSender = new TestSender( ); var anotherSender = new TestSender( ); using (var receiver = new TestReceiver( )) { receiver.SubscribeToMessagesFrom(aSender); receiver.SubscribeToMessagesFrom(anotherSender); aSender.SendMessage(MessageLevel.INFO, "Message sent from a sender."); anotherSender.SendMessage(MessageLevel.INFO, "Message sent from another sender."); Assert.That(receiver.MessageReceived, Is.True); } }
public void TestMessageRelaying( ) { var sender = new TestSender( ); using (var relay = new TestRelay( )) { using (var receiver = new TestReceiver( )) { relay.SubscribeToMessagesFrom(sender); receiver.SubscribeToMessagesFrom(relay); sender.SendMessage(MessageLevel.INFO, "Message sent from a sender."); relay.SendMessage(MessageLevel.INFO, "Message sent from a relay."); Assert.That(relay.MessageReceived, Is.True); Assert.That(receiver.MessageReceived, Is.True); } } }