public void ExtractMultipleChildrenInvalid() { SingleChild root= new SingleChild(); MultipleChildren extractMe= new MultipleChildren(); root.AddChild(extractMe); SingleChild child1= new SingleChild(); SingleChild child2= new SingleChild(); extractMe.AddChild(child1); extractMe.AddChild(child2); Assert.That(!extractMe.ExtractNode(), "Node was extracted although not allowed"); Assert.That(extractMe.Parent ==root, "Parent was modified"); Assert.That(extractMe.ParentConnector ==root.DefaultConnector, "Parent connector was modified"); Assert.That(child1.Parent ==extractMe, "Parent was modified on children"); Assert.That(child1.ParentConnector ==extractMe.DefaultConnector, "Parent connector modified on children"); Assert.That(child2.Parent ==extractMe, "Parent was modified on children"); Assert.That(child2.ParentConnector ==extractMe.DefaultConnector, "Parent connector was modified on children"); }
public void ExtractMultipleChildrenValid() { MultipleChildren root= new MultipleChildren(); MultipleChildren extractMe= new MultipleChildren(); root.AddChild(extractMe); SingleChild child1= new SingleChild(); SingleChild child2= new SingleChild(); extractMe.AddChild(child1); extractMe.AddChild(child2); Assert.That(extractMe.ExtractNode(), "Could not extract node"); Assert.That(extractMe.Parent ==null, "Parent was not cleared"); Assert.That(extractMe.ParentConnector ==null, "Parent connector was not cleared"); Assert.That(child1.Parent ==root, "Parent was not updated on children"); Assert.That(child1.ParentConnector ==root.DefaultConnector, "Parent connector was not updated on children"); Assert.That(child2.Parent ==root, "Parent was not updated on children"); Assert.That(child2.ParentConnector ==root.DefaultConnector, "Parent connector was not updated on children"); }