public void CanUnlinkTwice() { var parent = new ConfigurableDictionaryNode { Children = new List <ConfigurableDictionaryNode>(), Parent = null }; var node = new ConfigurableDictionaryNode { Children = new List <ConfigurableDictionaryNode>(), Parent = parent }; parent.Children.Add(node); node.UnlinkFromParent(); Assert.That(node.Parent, Is.Null); // node is now at the root of a hierarchy // SUT Assert.DoesNotThrow(() => node.UnlinkFromParent()); }
public void CanUnlink() { var parent = new ConfigurableDictionaryNode { Children = new List <ConfigurableDictionaryNode>(), Parent = null }; var node = new ConfigurableDictionaryNode { Children = new List <ConfigurableDictionaryNode>(), Parent = parent }; parent.Children.Add(node); // SUT node.UnlinkFromParent(); Assert.That(parent.Children.Count, Is.EqualTo(0), "Parent should not link to unlinked child"); Assert.That(node.Parent, Is.Null, "Node should not still claim the original parent"); }