public override void SetUp() { base.SetUp(); DatabaseSettings databaseSettings = DatabaseSettingsBuilder.Create(Host); DatabaseSettingsNode databaseSettingsNode = new DatabaseSettingsNode(databaseSettings); GeneratedApplicationNode.Nodes.Add(databaseSettingsNode); databaseSettingsNode.ResolveNodeReferences(); InstanceCollectionNode collectionNode = GeneratedHierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode; instanceNode = GeneratedHierarchy.FindNodeByName(collectionNode, name) as InstanceNode; }
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); }