public void Publish_CustomProxyWithFilter_UsesCorrectProxy() { var messenger = UtilityMethods.GetMessenger(); var proxy = new TestProxy(); messenger.Subscribe<TestMessage>(new Action<TestMessage>(UtilityMethods.FakeDeliveryAction<TestMessage>), new Func<TestMessage, bool>(UtilityMethods.FakeMessageFilter<TestMessage>), proxy); var message = new TestMessage(this); messenger.Publish<TestMessage>(message); Assert.ReferenceEquals(message, proxy.Message); }
public void Publish_SubscribedMessageNoFilter_GetsActualMessage() { var messenger = UtilityMethods.GetMessenger(); ITinyMessage receivedMessage = null; var payload = new TestMessage(this); messenger.Subscribe<TestMessage>((m) => { receivedMessage = m; }); messenger.Publish<TestMessage>(payload); Assert.ReferenceEquals(payload, receivedMessage); }
public void Publish_CustomProxyNoFilterStrongReference_UsesCorrectProxy() { var messenger = UtilityMethods.GetMessenger(); var proxy = new TestProxy(); messenger.Subscribe<TestMessage>(new Action<TestMessage>(UtilityMethods.FakeDeliveryAction<TestMessage>), true, proxy); var message = new TestMessage(this); messenger.Publish<TestMessage>(message); Assert.AreSame(message, proxy.Message); }