Esempio n. 1
0
 public void TestFindParent()
 {
     _header.Parent      = null;
     _childHeader.Parent = null;
     Assert.IsNull(_root.FindParent(MockHeaderName.Root), "FindParent (root, no parent)");
     Assert.IsNull(_root.FindParent(MockHeaderName.MockHeaderTypeTwo), "FindParent (other, no parent)");
     _header.AddChild(_childHeader);
     Assert.AreSame(_header, _childHeader.FindParent(MockHeaderName.MockHeaderTypeTwo), "FindParent (parent, no root)");
     Assert.IsNull(_childHeader.FindParent(MockHeaderName.MockHeaderTypeThree), "FindParent (other, no root)");
     _root.AddChild(_header);
     Assert.AreSame(_root, _childHeader.FindParent(MockHeaderName.Root), "FindParent (root, as grand parent)");
     Assert.AreSame(_root, _header.FindParent(MockHeaderName.Root), "FindParent (root, as parent)");
     Assert.AreSame(_header, _childHeader.FindParent(MockHeaderName.MockHeaderTypeTwo), "FindParent (parent)");
     Assert.IsNull(_childHeader.FindParent(MockHeaderName.MockHeaderTypeThree), "FindParent (other)");
 }
Esempio n. 2
0
 public void TestFindChild()
 {
     _root.AddChild(_header);
     _header.AddChild(_childHeader);
     _childHeader.AddChild(_lastHeader);
     Assert.AreSame(_header, _root.FindChild(MockHeaderName.MockHeaderTypeTwo), "FindChild (non-recursive)");
     Assert.IsNull(_root.FindChild(MockHeaderName.MockSubHeader), "FindChild (non-recursive, fail)");
     Assert.IsNull(_root.FindChild(MockHeaderName.MockSubHeader, false), "FindChild (non-recursive, fail)");
     Assert.AreSame(_childHeader, _root.FindChild(MockHeaderName.MockSubHeader, true), "FindChild (recursive)");
     Assert.IsNull(_root.FindChild(MockHeaderName.MockHeaderTypeOne, true), "FindChild (recursive, fail)");
 }
Esempio n. 3
0
 public void TestRoot()
 {
     Assert.AreSame(_root, _root.Root, "Root (this)");
     _root.AddChild(_header);
     Assert.AreSame(_root, _header.Root, "Root (ancestor)");
 }