public void RegistersHandlerForMessageWithoutTag() { TestMessage.Register(this, OnTestMessage); _messageSent = false; TestMessage.SendWith("test"); TestMessage.Unregister(this, OnTestMessage); Assert.IsTrue(_messageSent); }
public void SendsMessageWithDataWithTag() { var messageMediator = MessageMediator.Default; messageMediator.Register <TestMessage>(this, OnTestMessage, "mytag"); _messageSent = false; _messageData = null; TestMessage.SendWith("test", "mytag"); messageMediator.Unregister <TestMessage>(this, OnTestMessage, "mytag"); Assert.IsTrue(_messageSent); Assert.AreEqual("test", _messageData); }
public void UnregistersHandlerForMessageWithTag() { TestMessage.Register(this, OnTestMessage, "mytag"); _messageSent = false; TestMessage.SendWith("test", "mytag"); TestMessage.Unregister(this, OnTestMessage, "mytag"); Assert.IsTrue(_messageSent); _messageSent = false; TestMessage.SendWith("test", "mytag"); Assert.IsFalse(_messageSent); }