Esempio n. 1
0
        public void CleanupDependenciesTest()
        {
            var           base_obj      = new CleanupDependenciesBaseObject();
            WeakReference obj_reference = null;

            new Action(() =>
            {
                var obj = new CleanupDependenciesObject(base_obj);

                obj_reference = new WeakReference(obj);
                Assert.IsTrue(obj_reference.IsAlive, "CleanupDependenciesObject must be alive");

                obj.CleanupDependencies();
            })();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            Assert.IsFalse(obj_reference.IsAlive, "CleanupDependenciesObject must NOT be alive");
        }
Esempio n. 2
0
        public void CleanupDependenciesTest()
        {
            var base_obj = new CleanupDependenciesBaseObject();
            WeakReference obj_reference = null;

            new Action(() =>
                           {
                               var obj = new CleanupDependenciesObject(base_obj);

                               obj_reference = new WeakReference(obj);
                               Assert.IsTrue(obj_reference.IsAlive, "CleanupDependenciesObject must be alive");

                               obj.CleanupDependencies();
                           })();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            Assert.IsFalse(obj_reference.IsAlive, "CleanupDependenciesObject must NOT be alive");
        }