Ejemplo n.º 1
0
        public void ManageabilityProviderGeneratesProperAdmContentWithRegisteredProviders()
        {
            DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource();

            configurationSource.Add(ExceptionHandlingSettings.SectionName, section);

            ExceptionPolicyData policy1 = new ExceptionPolicyData("policy1");

            section.ExceptionPolicies.Add(policy1);
            ExceptionTypeData exceptionType11 = new ExceptionTypeData("type11", typeof(Exception), PostHandlingAction.None);

            policy1.ExceptionTypes.Add(exceptionType11);
            ExceptionHandlerData handler11 = new ExceptionHandlerData("handler11", typeof(object));

            exceptionType11.ExceptionHandlers.Add(handler11);

            MockConfigurationElementManageabilityProvider subProvider = new MockConfigurationElementManageabilityProvider(false, true);
            Dictionary <Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary <Type, ConfigurationElementManageabilityProvider>();

            subProviders.Add(typeof(ExceptionHandlerData), subProvider);
            provider = new ConfigurationSectionManageabilityProviderWrapper(new ExceptionHandlingSettingsManageabilityProvider(subProviders));

            MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder();

            provider.InvokeAddAdministrativeTemplateDirectives(contentBuilder, section, configurationSource, "TestApp");

            MockAdmContent            content = contentBuilder.GetMockContent();
            IEnumerator <AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator();

            Assert.IsTrue(categoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.SectionCategoryName, categoriesEnumerator.Current.Name);
            IEnumerator <AdmCategory> subCategoriesEnumerator = categoriesEnumerator.Current.Categories.GetEnumerator();

            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(policy1.Name, subCategoriesEnumerator.Current.Name);
            IEnumerator <AdmPolicy> policyPoliciesEnumerator = subCategoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(policyPoliciesEnumerator.MoveNext());
            Assert.AreEqual(String.Format(Resources.ExceptionTypePolicyNameTemplate, exceptionType11.Name), policyPoliciesEnumerator.Current.Name);
            IEnumerator <AdmPart> partsEnumerator = policyPoliciesEnumerator.Current.Parts.GetEnumerator();

            Assert.IsTrue(partsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType());
            Assert.IsNull(partsEnumerator.Current.KeyName);
            Assert.AreEqual(ExceptionHandlingSettingsManageabilityProvider.PolicyTypePostHandlingActionPropertyName,
                            partsEnumerator.Current.ValueName);
            Assert.IsTrue(partsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmTextPart), partsEnumerator.Current.GetType());
            Assert.AreEqual(Resources.ExceptionTypeHandlersPartName, partsEnumerator.Current.PartName);
            Assert.IsTrue(partsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmTextPart), partsEnumerator.Current.GetType());
            Assert.AreEqual(MockConfigurationElementManageabilityProvider.Part, partsEnumerator.Current.PartName);

            Assert.IsFalse(partsEnumerator.MoveNext());
            Assert.IsFalse(policyPoliciesEnumerator.MoveNext());

            Assert.IsFalse(subCategoriesEnumerator.MoveNext());
            Assert.IsFalse(categoriesEnumerator.MoveNext());
        }
Ejemplo n.º 2
0
        public void ManageabilityProviderGeneratesProperAdmContent()
        {
            DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource();

            OracleConnectionData data1 = new OracleConnectionData();

            section.OracleConnectionsData.Add(data1);
            data1.Name = "data1";
            data1.Packages.Add(new OraclePackageData("name1", "prefix1"));
            data1.Packages.Add(new OraclePackageData("name2", "pre;fix2"));
            OracleConnectionData data2 = new OracleConnectionData();

            section.OracleConnectionsData.Add(data2);
            data2.Name = "data2";

            MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder();

            provider.InvokeAddAdministrativeTemplateDirectives(contentBuilder, section, configurationSource, "TestApp");

            MockAdmContent            content = contentBuilder.GetMockContent();
            IEnumerator <AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator();

            Assert.IsTrue(categoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.DatabaseCategoryName, categoriesEnumerator.Current.Name);
            IEnumerator <AdmCategory> subCategoriesEnumerator = categoriesEnumerator.Current.Categories.GetEnumerator();

            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.OracleConnectionsCategoryName, subCategoriesEnumerator.Current.Name);
            IEnumerator <AdmPolicy> policiesEnumerator = subCategoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(policiesEnumerator.MoveNext());
            Assert.AreEqual(String.Format(Resources.OracleConnectionPolicyNameTemplate, data1.Name),
                            policiesEnumerator.Current.Name);
            IEnumerator <AdmPart> oracleDataPartsEnumerator = policiesEnumerator.Current.Parts.GetEnumerator();

            Assert.IsTrue(oracleDataPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmEditTextPart), oracleDataPartsEnumerator.Current.GetType());
            Assert.IsNull(oracleDataPartsEnumerator.Current.KeyName);
            Assert.AreEqual(OracleConnectionSettingsManageabilityProvider.PackagesPropertyName,
                            oracleDataPartsEnumerator.Current.ValueName);
            Assert.AreEqual(Resources.OracleConnectionPackagesPartName,
                            oracleDataPartsEnumerator.Current.PartName);
            IDictionary <String, String> packages = new Dictionary <String, String>();

            KeyValuePairParser.ExtractKeyValueEntries(((AdmEditTextPart)oracleDataPartsEnumerator.Current).DefaultValue, packages);
            Assert.AreEqual(2, packages.Count);
            Assert.AreEqual("prefix1", packages["name1"]);
            Assert.AreEqual("pre;fix2", packages["name2"]);

            Assert.IsFalse(oracleDataPartsEnumerator.MoveNext());
            Assert.IsTrue(policiesEnumerator.MoveNext());
            Assert.IsFalse(policiesEnumerator.MoveNext());

            Assert.IsFalse(subCategoriesEnumerator.MoveNext());
            IEnumerator <AdmPolicy> sectionPoliciesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsFalse(sectionPoliciesEnumerator.MoveNext());
            Assert.IsFalse(categoriesEnumerator.MoveNext());
        }
Ejemplo n.º 3
0
        public void ManageabilityProviderGeneratesProperAdmContent()
        {
            DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource();

            configurationSource.Add(SecuritySettings.SectionName, section);

            AuthorizationProviderData authorization = new AuthorizationProviderData("authorization", typeof(object));
            SecurityCacheProviderData security      = new SecurityCacheProviderData("security", typeof(object));

            section.AuthorizationProviders.Add(authorization);
            section.SecurityCacheProviders.Add(security);

            MockConfigurationElementManageabilityProvider subProvider = new MockConfigurationElementManageabilityProvider();
            Dictionary <Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary <Type, ConfigurationElementManageabilityProvider>();

            subProviders.Add(typeof(AuthorizationProviderData), subProvider);
            subProviders.Add(typeof(SecurityCacheProviderData), subProvider);
            provider = new ConfigurationSectionManageabilityProviderWrapper(new SecuritySettingsManageabilityProvider(subProviders));

            MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder();

            provider.InvokeAddAdministrativeTemplateDirectives(contentBuilder, section, configurationSource, "TestApp");

            Assert.AreEqual(2, subProvider.configurationObjects.Count);
            Assert.AreSame(authorization, subProvider.configurationObjects[0]);
            Assert.AreSame(security, subProvider.configurationObjects[1]);
            MockAdmContent            content = contentBuilder.GetMockContent();
            IEnumerator <AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator();

            Assert.IsTrue(categoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.SecuritySectionCategoryName, categoriesEnumerator.Current.Name);
            IEnumerator <AdmCategory> subCategoriesEnumerator = categoriesEnumerator.Current.Categories.GetEnumerator();

            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.AuthorizationProvidersCategoryName, subCategoriesEnumerator.Current.Name);
            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.SecurityCacheProvidersCategoryName, subCategoriesEnumerator.Current.Name);
            Assert.IsFalse(subCategoriesEnumerator.MoveNext());
            IEnumerator <AdmPolicy> sectionPoliciesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(sectionPoliciesEnumerator.MoveNext());
            Assert.AreEqual(Resources.SecuritySettingsPolicyName, sectionPoliciesEnumerator.Current.Name);
            IEnumerator <AdmPart> sectionPartsEnumerator = sectionPoliciesEnumerator.Current.Parts.GetEnumerator();

            Assert.IsTrue(sectionPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmDropDownListPart), sectionPartsEnumerator.Current.GetType());
            Assert.AreEqual(SecuritySettingsManageabilityProvider.DefaultAuthorizationProviderPropertyName,
                            ((AdmDropDownListPart)sectionPartsEnumerator.Current).ValueName);
            Assert.IsTrue(sectionPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmDropDownListPart), sectionPartsEnumerator.Current.GetType());
            Assert.AreEqual(SecuritySettingsManageabilityProvider.DefaultSecurityCacheProviderPropertyName,
                            ((AdmDropDownListPart)sectionPartsEnumerator.Current).ValueName);
            Assert.IsFalse(sectionPartsEnumerator.MoveNext());
            Assert.IsFalse(sectionPoliciesEnumerator.MoveNext());
            Assert.IsFalse(categoriesEnumerator.MoveNext());
        }
Ejemplo n.º 4
0
        public void ManageabilityProviderGeneratesProperAdmContent()
        {
            DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource();

            configurationSource.Add(CacheManagerSettings.SectionName, section);

            IsolatedStorageCacheStorageData storage1, storage2;
            CacheManagerData manager1, manager2;
            StorageEncryptionProviderData encryption1;

            section.BackingStores.Add(storage1          = new IsolatedStorageCacheStorageData("storage1", "encryption1", "partition1"));
            section.CacheManagers.Add(manager1          = new CacheManagerData("manager1", 100, 200, 300, "storage1"));
            section.EncryptionProviders.Add(encryption1 = new StorageEncryptionProviderData("encryption1", typeof(object)));
            section.BackingStores.Add(storage2          = new IsolatedStorageCacheStorageData("storage2", "", "partition2"));
            section.CacheManagers.Add(manager2          = new CacheManagerData("manager2", 100, 200, 300, "storage2"));

            MockConfigurationElementManageabilityProvider subProvider = new MockConfigurationElementManageabilityProvider();
            Dictionary <Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary <Type, ConfigurationElementManageabilityProvider>();

            subProviders.Add(typeof(IsolatedStorageCacheStorageData), subProvider);
            subProviders.Add(typeof(StorageEncryptionProviderData), subProvider);
            provider = new ConfigurationSectionManageabilityProviderWrapper(new CacheManagerSettingsManageabilityProvider(subProviders));

            MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder();

            provider.InvokeAddAdministrativeTemplateDirectives(contentBuilder, section, configurationSource, "TestApp");

            Assert.AreEqual(3, subProvider.configurationObjects.Count);
            Assert.AreSame(storage1, subProvider.configurationObjects[0]);
            Assert.AreSame(encryption1, subProvider.configurationObjects[1]);
            Assert.AreSame(storage2, subProvider.configurationObjects[2]);
            MockAdmContent            content = contentBuilder.GetMockContent();
            IEnumerator <AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator();

            Assert.IsTrue(categoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.CachingSectionCategoryName, categoriesEnumerator.Current.Name);
            IEnumerator <AdmCategory> subCategoriesEnumerator = categoriesEnumerator.Current.Categories.GetEnumerator();

            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.CacheManagersCategoryName, subCategoriesEnumerator.Current.Name);
            IEnumerator <AdmPolicy> cacheManagerPoliciesEnumerator = subCategoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(cacheManagerPoliciesEnumerator.MoveNext());
            Assert.AreEqual(String.Format(Resources.CacheManagerPolicyNameTemplate, manager1.Name), cacheManagerPoliciesEnumerator.Current.Name);
            Assert.IsTrue(cacheManagerPoliciesEnumerator.MoveNext());
            Assert.AreEqual(String.Format(Resources.CacheManagerPolicyNameTemplate, manager2.Name), cacheManagerPoliciesEnumerator.Current.Name);
            Assert.IsFalse(cacheManagerPoliciesEnumerator.MoveNext());
            Assert.IsFalse(subCategoriesEnumerator.MoveNext());
            IEnumerator <AdmPolicy> sectionPoliciesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(sectionPoliciesEnumerator.MoveNext());
            Assert.AreEqual(Resources.CacheManagerSettingsPolicyName, sectionPoliciesEnumerator.Current.Name);
            Assert.IsFalse(sectionPoliciesEnumerator.MoveNext());
            Assert.IsFalse(categoriesEnumerator.MoveNext());
        }
Ejemplo n.º 5
0
        public void ManageabilityProviderGeneratesProperAdmContent()
        {
            DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource();

            configurationSource.Add("connectionStrings", section);

            section.ConnectionStrings.Add(new ConnectionStringSettings("cs1", "cs1"));
            section.ConnectionStrings.Add(new ConnectionStringSettings("cs2", "cs2"));

            MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder();

            provider.InvokeAddAdministrativeTemplateDirectives(contentBuilder, section, configurationSource, "TestApp");

            MockAdmContent            content = contentBuilder.GetMockContent();
            IEnumerator <AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator();

            Assert.IsTrue(categoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.DatabaseCategoryName, categoriesEnumerator.Current.Name);
            IEnumerator <AdmCategory> subCategoriesEnumerator = categoriesEnumerator.Current.Categories.GetEnumerator();

            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.ConnectionStringsCategoryName, subCategoriesEnumerator.Current.Name);
            IEnumerator <AdmPolicy> policiesEnumerator = subCategoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(policiesEnumerator.MoveNext());
            Assert.AreEqual(String.Format(Resources.ConnectionStringPolicyNameTemplate, "cs1"),
                            policiesEnumerator.Current.Name);
            IEnumerator <AdmPart> connectionStringPartsEnumerator = policiesEnumerator.Current.Parts.GetEnumerator();

            Assert.IsTrue(connectionStringPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmEditTextPart), connectionStringPartsEnumerator.Current.GetType());
            Assert.IsNull(connectionStringPartsEnumerator.Current.KeyName);
            Assert.AreEqual(ConnectionStringsManageabilityProvider.ConnectionStringPropertyName,
                            connectionStringPartsEnumerator.Current.ValueName);
            Assert.AreEqual(Resources.ConnectionStringConnectionStringPartName,
                            connectionStringPartsEnumerator.Current.PartName);

            Assert.IsTrue(connectionStringPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmComboBoxPart), connectionStringPartsEnumerator.Current.GetType());
            Assert.IsNull(connectionStringPartsEnumerator.Current.KeyName);
            Assert.AreEqual(ConnectionStringsManageabilityProvider.ProviderNamePropertyName,
                            connectionStringPartsEnumerator.Current.ValueName);
            Assert.AreEqual(Resources.ConnectionStringProviderNamePartName,
                            connectionStringPartsEnumerator.Current.PartName);

            Assert.IsFalse(connectionStringPartsEnumerator.MoveNext());
            Assert.IsTrue(policiesEnumerator.MoveNext());
            Assert.IsFalse(policiesEnumerator.MoveNext());              // 2 connection strings -> 2 policies

            Assert.IsFalse(subCategoriesEnumerator.MoveNext());
            IEnumerator <AdmPolicy> sectionPoliciesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsFalse(sectionPoliciesEnumerator.MoveNext());
            Assert.IsFalse(categoriesEnumerator.MoveNext());
        }
Ejemplo n.º 6
0
        public void ManageabilityProviderGeneratesProperAdmContent()
        {
            HashProviderData hash = new HashProviderData("hash", typeof(object));

            section.HashProviders.Add(hash);
            SymmetricProviderData symmetric = new SymmetricProviderData("symmetric", typeof(object));

            section.SymmetricCryptoProviders.Add(symmetric);

            MockConfigurationElementManageabilityProvider subProvider = new MockConfigurationElementManageabilityProvider(true, false);
            Dictionary <Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary <Type, ConfigurationElementManageabilityProvider>();

            subProviders.Add(typeof(HashProviderData), subProvider);
            subProviders.Add(typeof(SymmetricProviderData), subProvider);
            provider = new ConfigurationSectionManageabilityProviderWrapper(new CryptographySettingsManageabilityProvider(subProviders));

            MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder();

            provider.InvokeAddAdministrativeTemplateDirectives(contentBuilder, section, configurationSource, "TestApp");

            Assert.AreEqual(2, subProvider.configurationObjects.Count);
            Assert.AreSame(hash, subProvider.configurationObjects[0]);
            Assert.AreSame(symmetric, subProvider.configurationObjects[1]);

            MockAdmContent            content = contentBuilder.GetMockContent();
            IEnumerator <AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator();

            Assert.IsTrue(categoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.CryptographySectionCategoryName, categoriesEnumerator.Current.Name);
            IEnumerator <AdmCategory> subCategoriesEnumerator = categoriesEnumerator.Current.Categories.GetEnumerator();

            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.HashProvidersCategoryName, subCategoriesEnumerator.Current.Name);
            IEnumerator <AdmPolicy> policiesEnumerator = subCategoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(policiesEnumerator.MoveNext());
            Assert.AreEqual(MockConfigurationElementManageabilityProvider.Policy, policiesEnumerator.Current.Name);
            Assert.IsFalse(policiesEnumerator.MoveNext());

            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.SymmetricCryptoProvidersCategoryName, subCategoriesEnumerator.Current.Name);
            policiesEnumerator = subCategoriesEnumerator.Current.Policies.GetEnumerator();
            Assert.IsTrue(policiesEnumerator.MoveNext());
            Assert.AreEqual(MockConfigurationElementManageabilityProvider.Policy, policiesEnumerator.Current.Name);
            Assert.IsFalse(policiesEnumerator.MoveNext());

            Assert.IsFalse(subCategoriesEnumerator.MoveNext());
            IEnumerator <AdmPolicy> sectionPoliciesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(sectionPoliciesEnumerator.MoveNext());
            Assert.AreEqual(Resources.CryptographySettingsPolicyName, sectionPoliciesEnumerator.Current.Name);
            IEnumerator <AdmPart> sectionPartsEnumerator = sectionPoliciesEnumerator.Current.Parts.GetEnumerator();

            Assert.IsTrue(sectionPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmDropDownListPart), sectionPartsEnumerator.Current.GetType());
            Assert.AreEqual(CryptographySettingsManageabilityProvider.DefaultHashProviderPropertyName,
                            sectionPartsEnumerator.Current.ValueName);
            Assert.AreEqual(Resources.CryptographySettingsDefaultHashProviderPartName,
                            sectionPartsEnumerator.Current.PartName);

            Assert.IsTrue(sectionPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmDropDownListPart), sectionPartsEnumerator.Current.GetType());
            Assert.AreEqual(CryptographySettingsManageabilityProvider.DefaultSymmetricCryptoProviderPropertyName,
                            sectionPartsEnumerator.Current.ValueName);
            Assert.AreEqual(Resources.CryptographySettingsDefaultSymmetricCryptoProviderPartName,
                            sectionPartsEnumerator.Current.PartName);

            Assert.IsFalse(sectionPartsEnumerator.MoveNext());
            Assert.IsFalse(sectionPoliciesEnumerator.MoveNext());
            Assert.IsFalse(categoriesEnumerator.MoveNext());
        }
Ejemplo n.º 7
0
        public void ManageabilityProviderGeneratesProperAdmContent()
        {
            DictionaryConfigurationSource configurationSource      = new DictionaryConfigurationSource();
            ConnectionStringsSection      connectionStringsSection = new ConnectionStringsSection();

            connectionStringsSection.ConnectionStrings.Add(
                new ConnectionStringSettings("database1", "connection1", "system.provider1"));
            connectionStringsSection.ConnectionStrings.Add(
                new ConnectionStringSettings("database2", "connection2", "system.provider2"));
            configurationSource.Add("connectionStrings", connectionStringsSection);

            section.DefaultDatabase = "database1";
            section.ProviderMappings.Add(new DbProviderMapping("system.provider1", typeof(SqlDatabase)));

            MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder();

            provider.InvokeAddAdministrativeTemplateDirectives(contentBuilder, section, configurationSource, "TestApp");

            MockAdmContent            content = contentBuilder.GetMockContent();
            IEnumerator <AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator();

            Assert.IsTrue(categoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.DatabaseCategoryName, categoriesEnumerator.Current.Name);
            IEnumerator <AdmCategory> subCategoriesEnumerator = categoriesEnumerator.Current.Categories.GetEnumerator();

            Assert.IsTrue(subCategoriesEnumerator.MoveNext());
            Assert.AreEqual(Resources.ProviderMappingsCategoryName, subCategoriesEnumerator.Current.Name);
            IEnumerator <AdmPolicy> policiesEnumerator = subCategoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(policiesEnumerator.MoveNext());
            Assert.AreEqual(String.Format(Resources.ProviderMappingPolicyNameTemplate, "system.provider1"),
                            policiesEnumerator.Current.Name);
            IEnumerator <AdmPart> providerPartsEnumerator = policiesEnumerator.Current.Parts.GetEnumerator();

            Assert.IsTrue(providerPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmComboBoxPart), providerPartsEnumerator.Current.GetType());
            Assert.IsNull(providerPartsEnumerator.Current.KeyName);
            Assert.AreEqual(DatabaseSettingsManageabilityProvider.DatabaseTypePropertyName,
                            providerPartsEnumerator.Current.ValueName);
            Assert.AreEqual(Resources.ProviderMappingDatabaseTypePartName,
                            providerPartsEnumerator.Current.PartName);

            Assert.IsFalse(providerPartsEnumerator.MoveNext());
            Assert.IsFalse(policiesEnumerator.MoveNext());

            Assert.IsFalse(subCategoriesEnumerator.MoveNext());
            IEnumerator <AdmPolicy> sectionPoliciesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator();

            Assert.IsTrue(sectionPoliciesEnumerator.MoveNext());
            Assert.AreEqual(Resources.DatabaseSettingsPolicyName, sectionPoliciesEnumerator.Current.Name);
            IEnumerator <AdmPart> sectionPartsEnumerator = sectionPoliciesEnumerator.Current.Parts.GetEnumerator();

            Assert.IsTrue(sectionPartsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmDropDownListPart), sectionPartsEnumerator.Current.GetType());
            Assert.IsNull(sectionPartsEnumerator.Current.KeyName);
            Assert.AreEqual(DatabaseSettingsManageabilityProvider.DefaultDatabasePropertyName,
                            sectionPartsEnumerator.Current.ValueName);
            Assert.AreEqual(Resources.DatabaseSettingsDefaultDatabasePartName,
                            sectionPartsEnumerator.Current.PartName);
            Assert.IsFalse(sectionPartsEnumerator.MoveNext());

            Assert.IsFalse(sectionPoliciesEnumerator.MoveNext());
            Assert.IsFalse(categoriesEnumerator.MoveNext());
        }