public void DisposeAnonymousRecipient() { var target = new Messenger(); var tester = new DisposeAnonymousTester(target); tester.Register(); int c = target.Publish(Message.Empty); Assert.AreEqual(1, c); Assert.IsTrue(tester.Received); tester.Received = false; tester = null; GC.Collect(); GC.WaitForPendingFinalizers(); c = target.Publish(Message.Empty); Assert.AreEqual(0, c); }
public void DisposeAnonymousRecipient() { var target = new Messenger(); var tester = new DisposeAnonymousTester(target); tester.Register(); int c = target.Publish(Message.Empty); Assert.AreEqual(1, c); Assert.IsTrue(tester.Received); tester.Received = false; tester = null; GC.Collect(); GC.WaitForPendingFinalizers(); c = target.Publish(Message.Empty); Assert.AreEqual(0, c); }