public void RegisterTreeNode() { TreeNodeFactory.Register(typeof(MyConfigurationNode), typeof(MyConfigurationTreeNode)); MyConfigurationNode node = new MyConfigurationNode("test"); ConfigurationTreeNode treeNode = TreeNodeFactory.Create(node); Assert.AreEqual(typeof(MyConfigurationTreeNode), treeNode.GetType()); }
public void AddNode() { TreeNodeFactory.Register(typeof(MyConfigurationNode), typeof(MyConfigurationTreeNode)); MockConfigurationTreeNode treeNode = new MockConfigurationTreeNode("test"); MyConfigurationNode childNode = new MyConfigurationNode("test"); treeNode.ConfigurationNode.Nodes.Add(childNode); Assert.AreEqual(1, treeNode.Nodes.Count); ConfigurationTreeNode childTreeNode = treeNode.Nodes[0] as ConfigurationTreeNode; Assert.AreSame(childTreeNode.ConfigurationNode, childNode); Assert.AreEqual(typeof(MyConfigurationTreeNode), childTreeNode.GetType()); }