예제 #1
0
        public void read_settings_from_config_file()
        {
            var expected = ConfigurationManager.AppSettings.Get(PropertyName);
            var config   = Configuration.For <IMyConfiguration>();

            Assert.Equal(expected, config.SqlConnectionString);
        }
예제 #2
0
        public void pick_up_user_level_environmental_variables()
        {
            var randomValue = Guid.NewGuid().ToString();

            using (EnvironmentVariable.UserLevel(PropertyName, randomValue))
            {
                var config = Configuration.For <IMyConfiguration>();
                Assert.Equal(randomValue, config.SqlConnectionString);
            }
        }
예제 #3
0
        public void give_precedence_to_process_level_over_user_level()
        {
            var randomValue = Guid.NewGuid().ToString();

            using (EnvironmentVariable.ProcessLevel(PropertyName, randomValue))
                using (EnvironmentVariable.UserLevel(PropertyName, "not this value"))
                {
                    var config = Configuration.For <IMyConfiguration>();
                    Assert.Equal(randomValue, config.SqlConnectionString);
                }
        }