Exemplo n.º 1
0
            public void RegistersHandlerForMessageWithoutTag()
            {
                TestMessage.Register(this, OnTestMessage);

                _messageSent = false;

                TestMessage.SendWith("test");

                TestMessage.Unregister(this, OnTestMessage);

                Assert.IsTrue(_messageSent);
            }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
            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);
            }