public void AttachTo() { var r = new MapNode(new MapTree(), "r"); var c1 = new MapNode(r, "c1"); var c11 = new MapNode(c1, "c11"); var c12 = new MapNode(c1, "c12"); var c13 = new MapNode(c1, "c13"); var c2 = new MapNode(r, "c2"); var c3 = new MapNode(r, "c3", NodePosition.Left); var c31 = new MapNode(c3, "c31"); var c32 = new MapNode(c3, "c32"); c3.Detach(); c3.AttachTo(c2); Assert.AreEqual(c2.FirstChild, c3); }
public void AttachTo_ChildrenAttached() { var r = new MapNode(new MapTree(), "r"); var c1 = new MapNode(r, "c1"); var c11 = new MapNode(c1, "c11"); var c12 = new MapNode(c1, "c12"); var c13 = new MapNode(c1, "c13"); var c2 = new MapNode(r, "c2"); var c3 = new MapNode(r, "c3", NodePosition.Left); var c31 = new MapNode(c3, "c31"); var c32 = new MapNode(c3, "c32"); c3.Detach(); c3.AttachTo(c2); Assert.IsTrue(c32.IsDescendent(c2)); }
public void Detach() { var r = new MapNode(new MapTree(), "r"); var c1 = new MapNode(r, "c1"); var c11 = new MapNode(c1, "c11"); var c12 = new MapNode(c1, "c12"); var c13 = new MapNode(c1, "c13"); var c2 = new MapNode(r, "c2"); var c3 = new MapNode(r, "c3", NodePosition.Left); var c31 = new MapNode(c3, "c31"); var c32 = new MapNode(c3, "c32"); c3.Detach(); Assert.IsTrue(c3.Detached); Assert.IsFalse(r.ChildNodes.Contains(c3)); }