public void AddingSameNodeToCollectionThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Foo"); TestConfigurationNode node1 = new TestConfigurationNode("Node"); testNode.AddNode(node1); testNode.AddNode(node1); }
public void AddingSameNodeToCollectionThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Foo"); TestConfigurationNode node1 = new TestConfigurationNode("Node"); testNode.AddNode(node1); testNode.AddNode(node1); }
public void MoveNodeAfterSiblingWithNullSiblingNodeThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); testNode.MoveAfter(testNode.Nodes[0], null); }
public void MoveNodeBeforeSiblingPositionWithNullSiblingNodeThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); testNode.MoveBefore(testNode.Nodes[2], null); }
public void CanGetNextSiblingNode() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode firstNode = (ConfigurationNode)testNode.Nodes[0]; Assert.AreEqual("ATest", firstNode.NextSibling.Name); }
public void MoveBeforeTestWithNullSiblingNode() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); CreateHierarchyAndAddToHierarchyService(testNode, CreateDefaultConfiguration()); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); testNode.MoveBefore(testNode.ChildNodes[2], null); }
public void RenameAChildNodeWithTheSameNameNotInAContainer() { TestConfigurationNode testNode = new TestConfigurationNode("Root"); testNode.AddNode(new TestConfigurationNode("Test")); TestConfigurationNode nameNode = new TestConfigurationNode("Test1"); testNode.AddNode(nameNode); nameNode.Name = "Test"; }
public void CanMoveNodeAfterSiblingNode() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode nodeA = (ConfigurationNode)testNode.Nodes[1]; testNode.MoveAfter(testNode.Nodes[0], nodeA); Assert.AreEqual("BTest", nodeA.NextSibling.Name); }
public void LastNodeIsTheLastChildAdded() { TestConfigurationNode node = new TestConfigurationNode("test"); TestConfigurationNode firstChild = new TestConfigurationNode("firstchild"); TestConfigurationNode lastChild = new TestConfigurationNode("lastchild"); node.AddNode(firstChild); node.AddNode(lastChild); Assert.AreSame(lastChild, node.LastNode); }
public void PreviousSiblingTest() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode lastNode = (ConfigurationNode)testNode.Nodes[2]; Assert.AreEqual("ATest", lastNode.PreviousSibling.Name); }
public void CanGetNextSiblingNode() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode firstNode = (ConfigurationNode)testNode.Nodes[0]; Assert.AreEqual("ATest", firstNode.NextSibling.Name); }
public void PreviousSiblingTest() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); CreateHierarchyAndAddToHierarchyService(testNode, CreateDefaultConfiguration()); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode lastNode = testNode.ChildNodes[2]; Assert.AreEqual("ATest", lastNode.PreviousSibling.Name); }
public void CanMoveNodeAfterSiblingNode() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode nodeA = (ConfigurationNode)testNode.Nodes[1]; testNode.MoveAfter(testNode.Nodes[0], nodeA); Assert.AreEqual("BTest", nodeA.NextSibling.Name); }
public void CanMoveNodeBeforePreviousSiblingPosition() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode nodeA = (ConfigurationNode)testNode.Nodes[1]; testNode.MoveBefore(testNode.Nodes[2], nodeA); Assert.AreEqual("CTest", nodeA.PreviousSibling.Name); }
public void MoveBeforeTest() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); CreateHierarchyAndAddToHierarchyService(testNode, CreateDefaultConfiguration()); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode nodeA = testNode.ChildNodes[1]; testNode.MoveBefore(testNode.ChildNodes[2], nodeA); Assert.AreEqual("CTest", nodeA.PreviousSibling.Name); }
public void MoveNodeBeforeSiblingWithNullParentThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.MoveBefore(testNode.Nodes[0], new TestConfigurationNode("Not A Child")); }
public void EnsureRemovedAndRemovingEventFiredForParentAndAllChildNodes() { workingNode = new TestConfigurationNode("B"); node.AddNode(workingNode); workingNode.Removed += new EventHandler <ConfigurationNodeChangedEventArgs>(NodeRemoved); workingNode.Removing += new EventHandler <ConfigurationNodeChangedEventArgs>(NodeRemoving); TestConfigurationNode workingChildNode = new TestConfigurationNode("working child"); workingNode.AddNode(workingChildNode); workingChildNode.Removed += new EventHandler <ConfigurationNodeChangedEventArgs>(NodeRemoved); workingChildNode.Removing += new EventHandler <ConfigurationNodeChangedEventArgs>(NodeRemoving); workingNode.Remove(); Assert.IsFalse(node.Nodes.Contains(workingNode)); ConfigurationNode match = null; foreach (ConfigurationNode childNode in node.Nodes) { if (childNode == workingNode) { match = childNode; } } Assert.IsNull(match); Assert.AreEqual(2, removeEventCount); workingNode.Removed -= new EventHandler <ConfigurationNodeChangedEventArgs>(NodeRemoved); workingNode.Removing -= new EventHandler <ConfigurationNodeChangedEventArgs>(NodeRemoving); workingChildNode.Removed -= new EventHandler <ConfigurationNodeChangedEventArgs>(NodeRemoved); workingChildNode.Removing -= new EventHandler <ConfigurationNodeChangedEventArgs>(NodeRemoving); }
public void EnsureRemovingAParentNodeChildNodeDoesNotNotifyParent() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.ChildRemoving += new EventHandler <ConfigurationNodeChangedEventArgs>(NodeChildRemoving); testNode.ChildRemoved += new EventHandler <ConfigurationNodeChangedEventArgs>(NodeChildRemoved); testNode.AddNode(new TestConfigurationNode("A")); testNode.AddNode(new TestConfigurationNode("B")); node.AddNode(testNode); testNode.Remove(); Assert.AreEqual(0, removeChildEventCount); Assert.AreEqual(0, removingChildEventCount); testNode.ChildRemoving += new EventHandler <ConfigurationNodeChangedEventArgs>(NodeChildRemoving); testNode.ChildRemoved += new EventHandler <ConfigurationNodeChangedEventArgs>(NodeChildRemoved); }
public void EnsureCanAddNodesWithNoHierarchySet() { TestConfigurationNode myNode = new TestConfigurationNode("Root"); myNode.AddNode(new TestConfigurationNode("Child")); Assert.AreEqual(1, myNode.Nodes.Count); Assert.IsNull(myNode.Hierarchy); }
public void MoveNodeBeforeSiblingWithDifferentParrent() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); TestConfigurationNode testNode2 = new TestConfigurationNode("Test2"); testNode2.AddNode(new TestConfigurationNode("ATest")); testNode.MoveBefore(testNode2.Nodes[0], testNode.Nodes[0]); }
public void CanMoveNodeAfterSiblingNode() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode nodeA = (ConfigurationNode)testNode.Nodes[1]; testNode.MoveAfter(testNode.Nodes[0], nodeA); Assert.AreEqual("BTest", nodeA.NextSibling.Name); string[] expectedNames = new string[] { "ATest", "BTest", "CTest" }; Assert.AreEqual(expectedNames.Length, testNode.Nodes.Count); for (int i = 0; i < expectedNames.Length; ++i) { Assert.AreEqual(expectedNames[i], testNode.Nodes[i].Name); } }
public void EnsureHierarchySetWhenAddingToNodeWithHierarchy() { TestConfigurationNode myNode = new TestConfigurationNode("Child1"); TestConfigurationNode childNode = new TestConfigurationNode("Child2"); myNode.AddNode(childNode); node.AddNode(myNode); Assert.IsNotNull(myNode.Hierarchy); Assert.AreSame(hierarchy, myNode.Hierarchy); Assert.IsNotNull(childNode.Hierarchy); Assert.AreSame(hierarchy, childNode.Hierarchy); }
public void MoveNodeBeforeSiblingWithNullParentThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.MoveBefore(testNode.Nodes[0], new TestConfigurationNode("Not A Child")); }
public void PreviousSiblingTest() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); CreateHierarchyAndAddToHierarchyService(testNode, CreateDefaultConfiguration()); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode lastNode = testNode.ChildNodes[2]; Assert.AreEqual("ATest", lastNode.PreviousSibling.Name); }
public void RenameAChildNodeWithTheSameNameNotInAContainer() { TestConfigurationNode testNode = new TestConfigurationNode("Root"); testNode.AddNode(new TestConfigurationNode("Test")); TestConfigurationNode nameNode = new TestConfigurationNode("Test1"); testNode.AddNode(nameNode); nameNode.Name = "Test"; }
public void EnsureRemovingAParentNodeChildNodeDoesNotNotifyParent() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.ChildRemoving += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeChildRemoving); testNode.ChildRemoved += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeChildRemoved); testNode.AddNode(new TestConfigurationNode("A")); testNode.AddNode(new TestConfigurationNode("B")); node.AddNode(testNode); testNode.Remove(); Assert.AreEqual(0, removeChildEventCount); Assert.AreEqual(0, removingChildEventCount); testNode.ChildRemoving += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeChildRemoving); testNode.ChildRemoved += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeChildRemoved); }
public void EnsureRemovedAndRemovingEventFiredForParentAndAllChildNodes() { workingNode = new TestConfigurationNode("B"); node.AddNode(workingNode); workingNode.Removed += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRemoved); workingNode.Removing += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRemoving); TestConfigurationNode workingChildNode = new TestConfigurationNode("working child"); workingNode.AddNode(workingChildNode); workingChildNode.Removed += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRemoved); workingChildNode.Removing += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRemoving); workingNode.Remove(); Assert.IsFalse(node.Nodes.Contains(workingNode)); ConfigurationNode match = null; foreach (ConfigurationNode childNode in node.Nodes) { if (childNode == workingNode) { match = childNode; } } Assert.IsNull(match); Assert.AreEqual(2, removeEventCount); workingNode.Removed -= new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRemoved); workingNode.Removing -= new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRemoving); workingChildNode.Removed -= new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRemoved); workingChildNode.Removing -= new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRemoving); }
public void EnsureCanAddNodesWithNoHierarchySet() { TestConfigurationNode myNode = new TestConfigurationNode("Root"); myNode.AddNode(new TestConfigurationNode("Child")); Assert.AreEqual(1, myNode.Nodes.Count); Assert.IsNull(myNode.Hierarchy); }
public void EnsureHierarchySetWhenAddingToNodeWithHierarchy() { TestConfigurationNode myNode = new TestConfigurationNode("Child1"); TestConfigurationNode childNode = new TestConfigurationNode("Child2"); myNode.AddNode(childNode); node.AddNode(myNode); Assert.IsNotNull(myNode.Hierarchy); Assert.AreSame(hierarchy, myNode.Hierarchy); Assert.IsNotNull(childNode.Hierarchy); Assert.AreSame(hierarchy, childNode.Hierarchy); }
public void PreviousSiblingTest() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode lastNode = (ConfigurationNode)testNode.Nodes[2]; Assert.AreEqual("ATest", lastNode.PreviousSibling.Name); }
public void MoveNodeAfterSiblingWithNullSiblingNodeThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); testNode.MoveAfter(testNode.Nodes[0], null); }
public void CanMoveNodeBeforePreviousSiblingPosition() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode nodeA = (ConfigurationNode)testNode.Nodes[1]; testNode.MoveBefore(testNode.Nodes[2], nodeA); Assert.AreEqual("CTest", nodeA.PreviousSibling.Name); }
public void MoveNodeBeforeSiblingPositionWithNullSiblingNodeThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); testNode.MoveBefore(testNode.Nodes[2], null); }
public void MoveNodeAfterWithNullSiblingNode() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); CreateHierarchyAndAddToHierarchyService(testNode, CreateDefaultConfiguration()); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); testNode.MoveAfter(testNode.ChildNodes[0], null); }
public void LastNodeIsTheLastChildAdded() { TestConfigurationNode node = new TestConfigurationNode("test"); TestConfigurationNode firstChild = new TestConfigurationNode("firstchild"); TestConfigurationNode lastChild = new TestConfigurationNode("lastchild"); node.AddNode(firstChild); node.AddNode(lastChild); Assert.AreSame(lastChild, node.LastNode); }
public void MoveNodeBeforeSiblingWithDifferentParrent() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); TestConfigurationNode testNode2 = new TestConfigurationNode("Test2"); testNode2.AddNode(new TestConfigurationNode("ATest")); testNode.MoveBefore(testNode2.Nodes[0], testNode.Nodes[0]); }
public void MoveBeforeTest() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); CreateHierarchyAndAddToHierarchyService(testNode, CreateDefaultConfiguration()); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.AddNode(new TestConfigurationNode("ATest")); testNode.AddNode(new TestConfigurationNode("CTest")); ConfigurationNode nodeA = testNode.ChildNodes[1]; testNode.MoveBefore(testNode.ChildNodes[2], nodeA); Assert.AreEqual("CTest", nodeA.PreviousSibling.Name); }