public void Should_load_app_settings()
        {
            var configurationStore = new ConfigurationStore().Initialize();

            var source = new ConfigurationManagerSource(configurationStore).Initialize();
            source.LoadConfiguration();

            var value1 = configurationStore.Get<string>("appSettings/key1");
            var value2 = configurationStore.Get<string>("appSettings/key2");
            var testInt = configurationStore.Get<int>("appSettings/testInt");

            Assert.AreEqual("value1", value1);
            Assert.AreEqual("value2", value2);
            Assert.AreEqual(54, testInt);
        }
Пример #2
0
        public void Should_load_app_settings()
        {
            var configurationStore = new ConfigurationStore().Initialize();

            var source = new ConfigurationManagerSource(configurationStore).Initialize();

            source.LoadConfiguration();

            var value1  = configurationStore.Get <string>("appSettings/key1");
            var value2  = configurationStore.Get <string>("appSettings/key2");
            var testInt = configurationStore.Get <int>("appSettings/testInt");

            Assert.AreEqual("value1", value1);
            Assert.AreEqual("value2", value2);
            Assert.AreEqual(54, testInt);
        }
        private ConfigurationManagerProvider LoadProvider(IEnumerable <KeyValuePair <string, string> > values)
        {
            ConfigurationFileUpdater.Update(values);

            var source = new ConfigurationManagerSource {
                Optional       = false,
                ReloadOnChange = false,
                Path           = System.Configuration.ConfigurationManager
                                 .OpenExeConfiguration(ConfigurationUserLevel.None)
                                 .FilePath
            };

            source.ResolveFileProvider();

            var p = new ConfigurationManagerProvider(source);

            p.Load();
            return(p);
        }