public void AddingSameNodeOnlyAddsTheXmlIncludeTypeOnce() { AddConfigurationSectionCommand cmd = new AddConfigurationSectionCommand(Host, typeof(MyConfigurationNode), section); cmd.Execute(GeneratedApplicationNode); 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); }
private void CreateCryptographySettingsNode() { if (!CryptographySettingsNodeExists()) { AddConfigurationSectionCommand cmd = new AddConfigurationSectionCommand(Site, typeof(CryptographySettingsNode), CryptographySettings.SectionName); cmd.Execute(Hierarchy.RootNode); } }
private void CreateDatabaseSettingsNode() { if (!DatabaseSettingsNodeExists()) { AddConfigurationSectionCommand cmd = new AddConfigurationSectionCommand(Site, typeof(DatabaseSettingsNode), DatabaseSettings.SectionName); cmd.Execute(Hierarchy.RootNode); } }
private void CreateCacheManagerSettingsNodeNode() { if (!CacheManagerSettingsNodeExists()) { AddConfigurationSectionCommand cmd = new AddConfigurationSectionCommand(Site, typeof(CacheManagerSettingsNode), CacheManagerSettings.SectionName); cmd.Execute(Hierarchy.RootNode); } }
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); }
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 SaveDefaultAuthenticationProviderAndSaveAndReloadsCorrectly() { GeneratedHierarchy.Load(); AddConfigurationSectionCommand cmd = new AddConfigurationSectionCommand(Host, typeof(SecuritySettingsNode), SecuritySettings.SectionName); cmd.Execute(GeneratedApplicationNode); SecuritySettingsNode securitySettingsNode = GeneratedHierarchy.FindNodeByType(typeof(SecuritySettingsNode)) as SecuritySettingsNode; Assert.IsNotNull(securitySettingsNode); AuthenticationProviderCollectionNode authenticationProviderCollectionNode = GeneratedHierarchy.FindNodeByType(securitySettingsNode, typeof(AuthenticationProviderCollectionNode)) as AuthenticationProviderCollectionNode; Assert.IsNotNull(authenticationProviderCollectionNode); AddChildNodeCommand addChildNodeCommand = new AddChildNodeCommand(Host, typeof(DbAuthenticationProviderNode)); addChildNodeCommand.Execute(authenticationProviderCollectionNode); Assert.AreEqual(typeof(DbAuthenticationProviderNode), addChildNodeCommand.ChildNode.GetType()); DbAuthenticationProviderNode dbAuthenticationProviderNode = (DbAuthenticationProviderNode)addChildNodeCommand.ChildNode; securitySettingsNode.DefaultAuthenticationInstance = (AuthenticationProviderNode)addChildNodeCommand.ChildNode; addChildNodeCommand = new AddChildNodeCommand(Host, typeof(HashAlgorithmProviderNode)); CryptographySettingsNode cryptographySettingsNode = GeneratedHierarchy.FindNodeByType(typeof(CryptographySettingsNode)) as CryptographySettingsNode; Assert.IsNotNull(cryptographySettingsNode); HashProviderCollectionNode hashProviderCollectionNode = GeneratedHierarchy.FindNodeByType(typeof(HashProviderCollectionNode)) as HashProviderCollectionNode; Assert.IsNotNull(hashProviderCollectionNode); addChildNodeCommand.Execute(hashProviderCollectionNode); Assert.AreEqual(typeof(HashAlgorithmProviderNode), addChildNodeCommand.ChildNode.GetType()); dbAuthenticationProviderNode.HashProvider = (HashProviderNode)addChildNodeCommand.ChildNode; DatabaseSettingsNode databaseSettingsNode = GeneratedHierarchy.FindNodeByType(typeof(DatabaseSettingsNode)) as DatabaseSettingsNode; Assert.IsNotNull(databaseSettingsNode); InstanceCollectionNode instanceCollectionNode = GeneratedHierarchy.FindNodeByType(databaseSettingsNode, typeof(InstanceCollectionNode)) as InstanceCollectionNode; Assert.IsNotNull(instanceCollectionNode); Assert.IsTrue(instanceCollectionNode.Nodes.Count > 0); InstanceNode instanceNode = (InstanceNode)instanceCollectionNode.Nodes[0]; dbAuthenticationProviderNode.Database = instanceNode; ValidateNodeCommand validateNodeCommand = new ValidateNodeCommand(Host); validateNodeCommand.Execute(GeneratedApplicationNode); Assert.AreEqual(0, ConfigurationErrorsCount); SaveApplicationConfigurationNodeCommand saveCmd = new SaveApplicationConfigurationNodeCommand(Host); saveCmd.Execute(GeneratedApplicationNode); ApplicationConfigurationNode applicationConfigurationNode = new ApplicationConfigurationNode(ApplicationData.FromCurrentAppDomain()); IUIHierarchy hierarchy = CreateHierarchyAndAddToHierarchyService(applicationConfigurationNode, CreateDefaultConfiguration()); HierarchyService.SelectedHierarchy = hierarchy; hierarchy.Open(); }