Ejemplo n.º 1
0
        public async Task KeepContextTest()
        {
            var view       = new View();
            var collection = new BindingCollection <Context>(view);
            var context    = new Context();

            collection.TrySetContext(context);

            var reference = GCHelper.Kill(ref context);

            await GCHelper.ForceCollect();

            Assert.IsTrue(reference.IsAlive);
        }
Ejemplo n.º 2
0
        public async Task DontKeepOwnerTest()
        {
            var view       = new View();
            var collection = new BindingCollection <Context>(view);

            Assert.IsTrue(collection.IsAlive);

            var reference = GCHelper.Kill(ref view);

            await GCHelper.ForceCollect();

            Assert.IsFalse(collection.IsAlive);
            Assert.IsFalse(reference.IsAlive);
        }