public void CanCreateDataCollectionForMultipleSectionMapping() { ConfigurationSectionManageabilityProviderAttribute[] sectionProviders = new ConfigurationSectionManageabilityProviderAttribute[2]; sectionProviders[0] = new ConfigurationSectionManageabilityProviderAttribute("section1", typeof(MockConfigurationSectionManageabilityProvider)); sectionProviders[1] = new ConfigurationSectionManageabilityProviderAttribute("section2", typeof(MockConfigurationSectionManageabilityProviderAlt)); ConfigurationElementManageabilityProviderAttribute[] elementProviders = new ConfigurationElementManageabilityProviderAttribute[0]; List <ConfigurationSectionManageabilityProviderData> providersDataCollection = ConvertToList(ManageableConfigurationSourceElementBuilder.BuildSectionManageabilityProvidersData(sectionProviders, elementProviders)); Assert.IsNotNull(providersDataCollection); Assert.AreEqual(2, providersDataCollection.Count); ConfigurationSectionManageabilityProviderData data1 = GetProviderData(providersDataCollection, "section1"); Assert.IsNotNull(data1); Assert.AreSame(typeof(MockConfigurationSectionManageabilityProvider), data1.Type); Assert.AreEqual(0, data1.ManageabilityProviders.Count); ConfigurationSectionManageabilityProviderData data2 = GetProviderData(providersDataCollection, "section1"); Assert.IsNotNull(data2); Assert.AreSame(typeof(MockConfigurationSectionManageabilityProvider), data2.Type); Assert.AreEqual(0, data2.ManageabilityProviders.Count); }
public void CanCreateDataCollectionWithElementProviders() { ConfigurationSectionManageabilityProviderAttribute[] sectionProviders = new ConfigurationSectionManageabilityProviderAttribute[1]; sectionProviders[0] = new ConfigurationSectionManageabilityProviderAttribute("section1", typeof(MockConfigurationSectionManageabilityProvider)); ConfigurationElementManageabilityProviderAttribute[] elementProviders = new ConfigurationElementManageabilityProviderAttribute[1]; elementProviders[0] = new ConfigurationElementManageabilityProviderAttribute(typeof(MockConfigurationElementManageabilityProvider), typeof(String), typeof(MockConfigurationSectionManageabilityProvider)); List <ConfigurationSectionManageabilityProviderData> providersDataCollection = ConvertToList(ManageableConfigurationSourceElementBuilder.BuildSectionManageabilityProvidersData(sectionProviders, elementProviders)); Assert.IsNotNull(providersDataCollection); Assert.AreEqual(1, providersDataCollection.Count); ConfigurationSectionManageabilityProviderData data1 = GetProviderData(providersDataCollection, "section1"); Assert.IsNotNull(data1); Assert.AreSame(typeof(MockConfigurationSectionManageabilityProvider), data1.Type); Assert.AreEqual(1, data1.ManageabilityProviders.Count); ConfigurationElementManageabilityProviderData elementData11 = GetProviderData <ConfigurationElementManageabilityProviderData>(data1.ManageabilityProviders, "String"); Assert.IsNotNull(elementData11); Assert.AreSame(typeof(MockConfigurationElementManageabilityProvider), elementData11.Type); Assert.AreSame(typeof(String), elementData11.TargetType); }
public void CanCreateDataCollectionForEmptyMappings() { ConfigurationSectionManageabilityProviderAttribute[] sectionProviders = new ConfigurationSectionManageabilityProviderAttribute[0]; ConfigurationElementManageabilityProviderAttribute[] elementProviders = new ConfigurationElementManageabilityProviderAttribute[0]; List <ConfigurationSectionManageabilityProviderData> providersDataCollection = ConvertToList(ManageableConfigurationSourceElementBuilder.BuildSectionManageabilityProvidersData(sectionProviders, elementProviders)); Assert.IsNotNull(providersDataCollection); Assert.AreEqual(0, providersDataCollection.Count); }
public void ManageabilityProviderIsProperlyRegistered() { ConfigurationElementManageabilityProviderAttribute selectedAttribute = null; Assembly assembly = typeof(CustomFormatterDataManageabilityProvider).Assembly; foreach (ConfigurationElementManageabilityProviderAttribute providerAttribute in assembly.GetCustomAttributes(typeof(ConfigurationElementManageabilityProviderAttribute), false)) { if (providerAttribute.ManageabilityProviderType.Equals(typeof(CustomFormatterDataManageabilityProvider))) { selectedAttribute = providerAttribute; break; } } Assert.IsNotNull(selectedAttribute); Assert.AreSame(typeof(LoggingSettingsManageabilityProvider), selectedAttribute.SectionManageabilityProviderType); Assert.AreSame(typeof(CustomFormatterData), selectedAttribute.TargetType); }