public void CleanUpKeepsNonGarbageCollectedHandlersRegistered() { var mediator = new MessageMediator(); var recipient = new MessageRecipient(); mediator.Register <string>(recipient, recipient.OnMessage); mediator.CleanUp(); Assert.IsTrue(mediator.IsRegistered <string>(recipient, recipient.OnMessage)); }
public void CleanUpClearsGarbageCollectedHandlers() { var mediator = new MessageMediator(); var recipient = new MessageRecipient(); mediator.Register <string>(recipient, recipient.OnMessage); recipient = null; GC.Collect(); mediator.CleanUp(); Assert.AreEqual(0, mediator.GetRegisteredHandlers <string>().Count); }
public void CleanUpWorksWhenNoHandlersRegistered() { var mediator = new MessageMediator(); mediator.CleanUp(); }
public void CleanUpKeepsNonGarbageCollectedHandlersRegistered() { var mediator = new MessageMediator(); var recipient = new MessageRecipient(); mediator.Register<string>(recipient, recipient.OnMessage); mediator.CleanUp(); Assert.IsTrue(mediator.IsRegistered<string>(recipient, recipient.OnMessage)); }
public void CleanUpClearsGarbageCollectedHandlers() { var mediator = new MessageMediator(); var recipient = new MessageRecipient(); mediator.Register<string>(recipient, recipient.OnMessage); recipient = null; GC.Collect(); mediator.CleanUp(); Assert.AreEqual(0, mediator.GetRegisteredHandlers<string>().Count); }