public void TreeNode_AddChildren_Test() { Mocks mocks = new Mocks(); var parent = mocks.Object(true); var child1 = mocks.Object(true); var child2 = mocks.Object(true); var childrenToAdd = new List <IObject> { child1.Object, child2.Object }; AGSTreeNode <IObject> parentNode = new AGSTreeNode <IObject>(parent.Object); AGSTreeNode <IObject> child1Node = new AGSTreeNode <IObject>(child1.Object); AGSTreeNode <IObject> child2Node = new AGSTreeNode <IObject>(child2.Object); child1.Setup(c => c.TreeNode).Returns(child1Node); child2.Setup(c => c.TreeNode).Returns(child2Node); parentNode.AddChildren(childrenToAdd); Assert.AreEqual(parent.Object, child1Node.Parent); Assert.AreEqual(parent.Object, child2Node.Parent); Assert.AreEqual(child1.Object, parentNode.Children[0]); Assert.AreEqual(child2.Object, parentNode.Children[1]); Assert.IsTrue(parentNode.HasChild(child1.Object)); Assert.IsTrue(parentNode.HasChild(child2.Object)); }
public InspectorTreeNode(IProperty property, IInspectorPropertyEditor editor, IFont font) { TreeNode = new AGSTreeNode <ITreeStringNode>(this); _item = new AGSStringItem(font); Text = property.Name; Property = property; Editor = editor; }
public InspectorTreeNode(IProperty property, IInspectorPropertyEditor editor, IFont font, bool isCategory) { TreeNode = new AGSTreeNode <ITreeStringNode>(this); _item = new AGSStringItem(font); Text = property.DisplayName; Property = property; Editor = editor; IsCategory = isCategory; }
public override void Init(IEntity entity) { base.Init(entity); TreeNode = new AGSTreeNode<IObject>((IObject)entity); }