public void FinalizeDisposable() { var disposable = new SampleFinalizableDisposable(); bool isFinalized = false; disposable.OnFinalize = () => isFinalized = true; disposable = null; GC.Collect(); GC.WaitForPendingFinalizers(); Assert.IsTrue(isFinalized); }
private void CreateDisposable(Action onFinalize) { var disposable = new SampleFinalizableDisposable(onFinalize); }