public void StaticReferenceIsAlive() { var wd = new WeakDelegate(new Func <int>(TestClass.SomeStaticMethod)); GC.Collect(); Assert.IsTrue(wd.IsAlive); Assert.IsTrue(wd.Equals(new Func <int>(TestClass.SomeStaticMethod))); }
public void InstanceReferenceStillAlive() { TestClass tc = new TestClass(); WeakDelegate wd = new WeakDelegate(new Func <int>(tc.SomeMethod)); GC.Collect(); Assert.IsTrue(wd.IsAlive); Assert.IsTrue(wd.Equals(new Func <int>(tc.SomeMethod))); }