public void HasHandler() { var participants = new Participant[] { new Participant("Participant 1"), new Participant("Participant 2"), new Participant("Participant 3") }; IMediator mediator = null; try { mediator = new Mediator(); mediator.Register<ChatMessageEventArgs>(participants[0].InterceptMessage); mediator.RegisterFinalizer<ChatMessageEventArgs>(participants[2].OnRecieveMessage); Assert.That(mediator.IsEmpty(), Is.False); mediator.Deregister<ChatMessageEventArgs>(participants[0].InterceptMessage); Assert.That(mediator.IsEmpty(), Is.False); mediator.DeregisterFinalizer<ChatMessageEventArgs>(participants[2].OnRecieveMessage); Assert.That(mediator.IsEmpty(), Is.True); } finally { for (int i = 0; i < participants.Length; i++) { participants[i].Dispose(); } var disposableMediator = mediator as IDisposable; if(disposableMediator != null) { disposableMediator.Dispose(); } } }