public void RemoveNodeTest() { ConfigurationSectionNode node = appNode.Nodes[0] as ConfigurationSectionNode; Assert.IsNotNull(node); node.Remove(); Assert.AreEqual(0, appNode.Nodes.Count); }
public void GetStorageProviderTest() { ConfigurationSectionNode sectionNode = new ConfigurationSectionNode(); CreateHierarchyAndAddToHierarchyService(sectionNode, CreateDefaultConfiguration()); Assert.IsNull(sectionNode.SelectStorageProviderNode()); XmlFileStorageProviderData data = new XmlFileStorageProviderData("myData", "myPath"); XmlFileStorageProviderNode providerNode = new XmlFileStorageProviderNode(data); sectionNode.Nodes.Add(providerNode); StorageProviderNode providerNodeCompare = sectionNode.SelectStorageProviderNode(); Assert.IsNotNull(providerNodeCompare); Assert.AreSame(providerNode, providerNodeCompare); }
public void ExecuteTest() { AddConfigurationSectionCommand command = new AddConfigurationSectionCommand(Host, typeof(MockConfigurationNode), "mySection"); command.Execute(GeneratedApplicationNode); Assert.AreEqual(2, GeneratedApplicationNode.Nodes.Count); ConfigurationSectionCollectionNode collectionNode = (ConfigurationSectionCollectionNode)GeneratedHierarchy.FindNodeByType(GeneratedApplicationNode, typeof(ConfigurationSectionCollectionNode)); Assert.IsNotNull(collectionNode); ConfigurationSectionNode sectionNode = GeneratedHierarchy.FindNodeByName(collectionNode, "mySection") as ConfigurationSectionNode; Assert.IsNotNull(sectionNode); }
public void MakeSureThatIncludeTypesAreAddedForTheSection() { AddConfigurationSectionCommand cmd = new AddConfigurationSectionCommand(Host, typeof(MyConfigurationNode), section); cmd.Execute(GeneratedApplicationNode); ConfigurationSectionCollectionNode node = (ConfigurationSectionCollectionNode)GeneratedHierarchy.FindNodeByType(typeof(ConfigurationSectionCollectionNode)); Assert.IsNotNull(node); ConfigurationSectionNode sectionNode = (ConfigurationSectionNode)GeneratedHierarchy.FindNodeByName(node, section); ConfigurationNode[] types = GeneratedHierarchy.FindNodesByType(sectionNode, typeof(XmlIncludeTypeNode)); Assert.AreEqual(1, types.Length); XmlIncludeTypeNode xmlIncludeTypeNode = types[0] as XmlIncludeTypeNode; Assert.IsNotNull(xmlIncludeTypeNode); Assert.AreEqual(xmlIncludeTypeNode.Name, typeof(MyConfigurationData).Name); }
public void TwoNodesShareTheSameConfigurationAndIncludeTypeRemoveOneIncludeTypeRemains() { AddConfigurationSectionCommand cmd = new AddConfigurationSectionCommand(Host, typeof(MyConfigurationNode), section); cmd.Execute(GeneratedApplicationNode); cmd.Execute(GeneratedApplicationNode); ConfigurationNode secondAddedNode = cmd.ChildNode; RemoveNodeCommand removeNodeCommand = new RemoveNodeCommand(Host); removeNodeCommand.Execute(secondAddedNode); ConfigurationSectionCollectionNode node = (ConfigurationSectionCollectionNode)GeneratedHierarchy.FindNodeByType(typeof(ConfigurationSectionCollectionNode)); Assert.IsNotNull(node); ConfigurationSectionNode sectionNode = (ConfigurationSectionNode)GeneratedHierarchy.FindNodeByName(node, section); ConfigurationNode[] types = GeneratedHierarchy.FindNodesByType(sectionNode, typeof(XmlIncludeTypeNode)); Assert.AreEqual(1, types.Length); XmlIncludeTypeNode xmlIncludeTypeNode = types[0] as XmlIncludeTypeNode; Assert.IsNotNull(xmlIncludeTypeNode); Assert.AreEqual(xmlIncludeTypeNode.Name, typeof(MyConfigurationData).Name); }