public void UnregistersAllMethodsOfRecipient() { var mediator = new MessageMediator(); var recipient = new MessageRecipient(); mediator.Register <string>(recipient, recipient.OnMessage); mediator.Register <string>(recipient, recipient.AnotherOnMessage); mediator.Register <string>(recipient, recipient.YetAnotherOnMessage); Assert.IsTrue(mediator.IsRegistered <string>(recipient, recipient.OnMessage)); Assert.IsTrue(mediator.IsRegistered <string>(recipient, recipient.AnotherOnMessage)); Assert.IsTrue(mediator.IsRegistered <string>(recipient, recipient.YetAnotherOnMessage)); mediator.UnregisterRecipient(recipient); Assert.IsFalse(mediator.IsRegistered <string>(recipient, recipient.OnMessage)); Assert.IsFalse(mediator.IsRegistered <string>(recipient, recipient.AnotherOnMessage)); Assert.IsFalse(mediator.IsRegistered <string>(recipient, recipient.YetAnotherOnMessage)); }
public void UnregistersAllMethodsOfRecipient() { var mediator = new MessageMediator(); var recipient = new MessageRecipient(); mediator.Register<string>(recipient, recipient.OnMessage); mediator.Register<string>(recipient, recipient.AnotherOnMessage); mediator.Register<string>(recipient, recipient.YetAnotherOnMessage); Assert.IsTrue(mediator.IsRegistered<string>(recipient, recipient.OnMessage)); Assert.IsTrue(mediator.IsRegistered<string>(recipient, recipient.AnotherOnMessage)); Assert.IsTrue(mediator.IsRegistered<string>(recipient, recipient.YetAnotherOnMessage)); mediator.UnregisterRecipient(recipient); Assert.IsFalse(mediator.IsRegistered<string>(recipient, recipient.OnMessage)); Assert.IsFalse(mediator.IsRegistered<string>(recipient, recipient.AnotherOnMessage)); Assert.IsFalse(mediator.IsRegistered<string>(recipient, recipient.YetAnotherOnMessage)); }