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); }
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); }