示例#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");
        }
示例#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");
        }
示例#3
0
        public CleanupDependenciesObject(CleanupDependenciesBaseObject base_object)
        {
            BaseObject = base_object;

            AddDependency(() => BaseObject.BaseProp1, () => Prop1);
        }
示例#4
0
        public CleanupDependenciesObject(CleanupDependenciesBaseObject base_object)
        {
            BaseObject = base_object;

            AddDependency(() => BaseObject.BaseProp1, () => Prop1);
        }