public override void FixtureSetUp() { base.FixtureSetUp(); using (DerivedXmlTreeViewContainerControl treeViewContainer = new DerivedXmlTreeViewContainerControl()) { treeViewContainer.LoadXml("<root/>"); doc = treeViewContainer.Document; XmlTreeViewControl treeView = treeViewContainer.TreeView; rootNode = (XmlElementTreeNode)treeView.Nodes[0]; // No node selected in treeview - adding a child // node should do nothing. treeView.SelectedNode = null; XmlElement testElement = doc.CreateElement("test"); treeViewContainer.AppendChildElement(testElement); treeView.SelectedNode = rootNode; XmlElement childElement = doc.CreateElement("child"); treeViewContainer.AppendChildElement(childElement); // No node selected in treeview - inserting a node // node should do nothing. treeView.SelectedNode = null; treeViewContainer.AppendChildElement(testElement); XmlElementTreeNode childNode = (XmlElementTreeNode)rootNode.Nodes[0]; treeView.SelectedNode = childNode; XmlElement beforeElement = doc.CreateElement("before"); treeViewContainer.InsertElementBefore(beforeElement); // No node selected in treeview - inserting a node // node should do nothing. treeView.SelectedNode = null; treeViewContainer.AppendChildElement(testElement); treeView.SelectedNode = childNode; XmlElement afterElement = doc.CreateElement("after"); treeViewContainer.InsertElementAfter(afterElement); } }