public void CanBuildCustomHashProviderFromGivenConfiguration()
        {
            CustomHashProviderData customData
                = new CustomHashProviderData("custom", typeof(MockCustomHashProvider));

            customData.SetAttributeValue(MockCustomProviderBase.AttributeKey, "value1");
            CryptographySettings settings = new CryptographySettings();

            settings.HashProviders.Add(customData);
            DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource();

            configurationSource.Add(CryptographyConfigurationView.SectionName, settings);

            IHashProvider custom
                = EnterpriseLibraryFactory.BuildUp <IHashProvider>("custom", configurationSource);

            Assert.IsNotNull(custom);
            Assert.AreSame(typeof(MockCustomHashProvider), custom.GetType());
            Assert.AreEqual("value1", ((MockCustomHashProvider)custom).customValue);
        }
        public void CanBuildCustomHashProviderFromSavedConfiguration()
        {
            CustomHashProviderData customData
                = new CustomHashProviderData("custom", typeof(MockCustomHashProvider));

            customData.SetAttributeValue(MockCustomProviderBase.AttributeKey, "value1");
            CryptographySettings settings = new CryptographySettings();

            settings.HashProviders.Add(customData);

            IDictionary <string, ConfigurationSection> sections = new Dictionary <string, ConfigurationSection>(1);

            sections[CryptographyConfigurationView.SectionName] = settings;
            IConfigurationSource configurationSource
                = ConfigurationTestHelper.SaveSectionsInFileAndReturnConfigurationSource(sections);

            IHashProvider custom
                = EnterpriseLibraryFactory.BuildUp <IHashProvider>("custom", configurationSource);

            Assert.IsNotNull(custom);
            Assert.AreSame(typeof(MockCustomHashProvider), custom.GetType());
            Assert.AreEqual("value1", ((MockCustomHashProvider)custom).customValue);
        }