public void DisposerRegistryTest() { DisposerRegistry.Clear(); Assert.AreEqual(0, DisposerRegistry.LeakedObjects.Count); using (var f = new SampleDisposable()) { DisposerRegistry.Add(f); Assert.AreEqual(1, DisposerRegistry.LeakedObjects.Count); Assert.IsTrue(DisposerRegistry.LeakedObjects.Values.Any( o => o.Target == f)); DisposerRegistry.Remove(f); Assert.AreEqual(0, DisposerRegistry.LeakedObjects.Count); } }