public void RenameSameNameTest() { node.AddNode(new TestConfigurationNode("Test")); node.AddNode(new TestConfigurationNode("Test3")); workingNode = node.Nodes[1] as TestConfigurationNode; Assert.AreEqual("Test3", workingNode.Name); }
public void AddingSameNodeToCollectionThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Foo"); TestConfigurationNode node1 = new TestConfigurationNode("Node"); testNode.AddNode(node1); testNode.AddNode(node1); }
public void MoveNodeBeforeSiblingWithNullParentThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.AddNode(new TestConfigurationNode("BTest")); testNode.MoveBefore(testNode.Nodes[0], new TestConfigurationNode("Not A Child")); }
public override void SetUp() { base.SetUp(); node = new TestConfigurationNode(); CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration()); addChildNodeCommand = new AddChildNodeCommand(Host, typeof(TestConfigurationNode)); }
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 FirstNodeTest() { TestConfigurationNode node = new TestConfigurationNode("test"); CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration()); TestConfigurationNode firstChild = new TestConfigurationNode("firstchild"); node.Nodes.Add(firstChild); Assert.AreSame(firstChild, node.FirstNode); }
public void RenameAChildNodeWithTheSameNameInAContainer() { node.AddNode(new TestConfigurationNode("Test")); TestConfigurationNode nameNode = new TestConfigurationNode("Test1"); node.AddNode(nameNode); nameNode.Name = "Test"; }
public void FirstNodeIsTheFirstChildAdded() { TestConfigurationNode node = new TestConfigurationNode("test"); TestConfigurationNode firstChild = new TestConfigurationNode("firstchild"); node.AddNode(firstChild); Assert.AreSame(firstChild, node.FirstNode); }
public void GetUniqueDisplayNameTest() { node.AddNode(new TestConfigurationNode("Node")); node.AddNode(new TestConfigurationNode("Node")); TestConfigurationNode newNode = node.Nodes[1] as TestConfigurationNode; Assert.AreEqual("Node1", newNode.Name); }
public void ChildAddedTest() { node.ChildAdded += new ConfigurationNodeChangedEventHandler(NodeChildAdded); workingNode = new TestConfigurationNode("New Node"); node.AddNode(workingNode); Assert.AreEqual(1, addChildEventCount); node.ChildAdded -= new ConfigurationNodeChangedEventHandler(NodeChildAdded); }
public void GetUniqueDisplayNameTest() { node.Nodes.Add(new TestConfigurationNode("Test")); int index = node.AddNode(new TestConfigurationNode("Test")); TestConfigurationNode newNode = node.Nodes[index] as TestConfigurationNode; Assert.AreEqual("Test1", newNode.Name); node.Nodes.Clear(); }
public void MergedConfigurationNodeHidesPropertiesMarkedAsNonOverridable() { TestConfigurationNode testnode = new TestConfigurationNode(); MergedConfigurationNode mergedNode = new MergedConfigurationNode(testnode, new ConfigurationNodeMergeData()); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(mergedNode); Assert.IsNull(properties["OverridesHiddenProperty"]); }
public void MergedConfigurationNodeHidesNameProperty() { TestConfigurationNode testnode = new TestConfigurationNode(); MergedConfigurationNode mergedNode = new MergedConfigurationNode(testnode, new ConfigurationNodeMergeData()); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(mergedNode); Assert.IsNull(properties["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 NonSerializableTypesAreHidden() { TestConfigurationNode testnode = new TestConfigurationNode(); MergedConfigurationNode mergedNode = new MergedConfigurationNode(testnode, new ConfigurationNodeMergeData()); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(mergedNode); Assert.IsNull(properties["NonSerializableProperty"]); }
public void MergedConfigurationNodeReturnsRegularProperties() { TestConfigurationNode testnode = new TestConfigurationNode(); MergedConfigurationNode mergedNode = new MergedConfigurationNode(testnode, new ConfigurationNodeMergeData()); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(mergedNode); Assert.IsNotNull(properties["Property1"]); }
public void RenameSameNameTest() { node.Nodes.Add(new TestConfigurationNode("Test")); int index = node.AddNode(new TestConfigurationNode("Test")); workingNode = node.Nodes[index] as TestConfigurationNode; workingNode.Name = "Test3"; Assert.AreEqual("Test3", workingNode.Name); }
public void ChangedTest() { workingNode = new TestConfigurationNode("New Node"); CreateHierarchyAndAddToHierarchyService(workingNode, CreateDefaultConfiguration()); workingNode.Changed += new ConfigurationNodeChangedEventHandler(WorkingNodeChanged); workingNode.Name = "New Name"; Assert.AreEqual(1, changedEventCount); workingNode.Changed -= new ConfigurationNodeChangedEventHandler(WorkingNodeChanged); }
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 EnsureCanAddNodesWithNoHierarchySet() { TestConfigurationNode myNode = new TestConfigurationNode("Root"); myNode.AddNode(new TestConfigurationNode("Child")); Assert.AreEqual(1, myNode.Nodes.Count); Assert.IsNull(myNode.Hierarchy); }
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 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 MergedConfigurationNodeConvertsToDisplayText() { TestConfigurationNode testnode = new TestConfigurationNode(); MergedConfigurationNode mergedNode = new MergedConfigurationNode(testnode, new ConfigurationNodeMergeData()); TypeConverter converter = TypeDescriptor.GetConverter(mergedNode); string displayText = converter.ConvertToInvariantString(mergedNode); Assert.AreEqual("Don't Override Properties", displayText); }
public void ReturnedPropertiesAreMergedConfigurationProperty() { TestConfigurationNode testnode = new TestConfigurationNode(); MergedConfigurationNode mergedNode = new MergedConfigurationNode(testnode, new ConfigurationNodeMergeData()); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(mergedNode); Assert.IsNotNull(properties["Property1"]); Assert.AreEqual(typeof(MergedConfigurationProperty), properties["Property1"].GetType()); }
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 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 override void SetUp() { base.SetUp(); node = new TestConfigurationNode(labelName); CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration()); addChildEventCount = 0; removeChildEventCount = 0; renamedEventCount = 0; removeEventCount = 0; changedEventCount = 0; }
public void RemoveNodeLeavesOnlyOneNodeInChildNodeArray() { TestConfigurationNode nodeA = new TestConfigurationNode("A"); TestConfigurationNode nodeB = new TestConfigurationNode("B"); node.AddNode(nodeA); node.AddNode(nodeB); nodeA.Remove(); Assert.AreEqual(1, node.Nodes.Count); }
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 TestInitialize() { workingNode = null; node = new ConfigurationApplicationNode(); hierarchy = new ConfigurationUIHierarchy(node, ServiceBuilder.Build()); addingChildEventCount = 0; addChildEventCount = 0; removingChildEventCount = 0; removeChildEventCount = 0; renamingEventCount = 0; renamedEventCount = 0; removingEventCount = 0; removeEventCount = 0; }
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 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 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 MoveNodeBeforeSiblingWithNullChildNodeThrows() { TestConfigurationNode testNode = new TestConfigurationNode("Test"); testNode.MoveBefore(null, null); }
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 EnsureWhenAddingNodesWithTheSameNameNotRootedInHierarchyItIsUpdatedInHierarchyAndNode() { TestConfigurationNode myNode = new TestConfigurationNode("Child"); TestConfigurationNode myNode2= new TestConfigurationNode("Child"); node.AddNode(myNode2); node.AddNode(myNode); Assert.IsNotNull(myNode.Hierarchy); Assert.AreSame(hierarchy, myNode.Hierarchy); Assert.AreEqual("Child1", myNode.Name); Assert.IsNotNull(myNode2.Hierarchy); Assert.AreSame(hierarchy, myNode2.Hierarchy); }
public void EnsureNodeIsRenamedAndRenameAndRenamingEventFires() { node.AddNode(new TestConfigurationNode("Test1")); node.AddNode(new TestConfigurationNode("Test2")); workingNode = node.Nodes[1] as TestConfigurationNode; workingNode.Renamed += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRenamed); workingNode.Renaming += new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRenaming); workingNode.Name = "MyTest"; Assert.AreEqual("MyTest", workingNode.Name); Assert.AreEqual(1, renamedEventCount); Assert.AreEqual(1, renamingEventCount); workingNode.Renamed -= new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRenamed); workingNode.Renaming -= new EventHandler<ConfigurationNodeChangedEventArgs>(NodeRenaming); }