Beispiel #1
0
        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)));
        }
Beispiel #2
0
        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)));
        }