public async Task DisposeAsync_ShouldFreeTheChildrenRecursively() { IMyComposite root = new MyComposite(), child = new MyComposite(root), grandChild = new MyComposite(child); await root.DisposeAsync(); Assert.Throws <ObjectDisposedException>(grandChild.Dispose); Assert.Throws <ObjectDisposedException>(child.Dispose); }
public async Task DisposeAsync_ShouldRemoveTheChildFromTheParentsChildrenList() { IMyComposite root = new MyComposite(), child = new MyComposite(root); new MyComposite(root); // harmadik Assert.That(root.Children.Count, Is.EqualTo(2)); await child.DisposeAsync(); Assert.That(root.Children.Count, Is.EqualTo(1)); }