public void HandlerMemoryLeakTest() { var publisher = new TestEventPublisher(); var testObject = new HandlerMemoryLeakTestClass(publisher); var dummyWeakReference = new WeakReference <HandlerMemoryLeakTestClass>(testObject); testObject.Dispose(); testObject = null; GC.Collect(); GC.WaitForPendingFinalizers(); HandlerMemoryLeakTestClass result = null; dummyWeakReference.TryGetTarget(out result).Is(false); result.IsNull(); }
public void HandlerMemoryLeakTest() { var publisher = new TestEventPublisher(); var testObject = new HandlerMemoryLeakTestClass(publisher); var dummyWeakReference = new WeakReference<HandlerMemoryLeakTestClass>(testObject); testObject.Dispose(); testObject = null; GC.Collect(); GC.WaitForPendingFinalizers(); HandlerMemoryLeakTestClass result = null; dummyWeakReference.TryGetTarget(out result).Is(false); result.IsNull(); }