Exemple #1
0
        public void FromEnvironmentProviderTest_NullRetrieval()
        {
            var fromEnvironmentProvider = new FromEnvironmentProvider();

            Environment.SetEnvironmentVariable("ExistingKey", "ExistingKeyValue");

            var nullKeyValue = fromEnvironmentProvider.GetRawSetting(null);
        }
Exemple #2
0
        public void FromEnvironmentProviderTest_NonExistingRetrieval()
        {
            var fromEnvironmentProvider = new FromEnvironmentProvider();

            Environment.SetEnvironmentVariable("ExistingKey", "ExistingKeyValue");

            var notExistingKeyValue = fromEnvironmentProvider.GetRawSetting("NotExistingKey");

            Assert.IsNull(notExistingKeyValue, "Not existing key value is not null!");
        }
Exemple #3
0
        public void FromEnvironmentProviderTest_SimpleRetrieval()
        {
            var fromEnvironmentProvider = new FromEnvironmentProvider();

            Environment.SetEnvironmentVariable("ExistingKey", "ExistingKeyValue");

            var existingKeyValue = fromEnvironmentProvider.GetRawSetting("ExistingKey");

            Assert.AreEqual("ExistingKeyValue", existingKeyValue);
        }
        private static SettingsFiller GetAdvancedSettingsFiller()
        {
            var converterChooser     = new SettingsConverterChooser(new IRawSettingsConverter[] { new StringToFrameworkTypesConverter(), new SuperConverter() });
            var funcSettingsProvider = new FromFuncProvider(key => new C());
            var envSettingsProvider  = new FromEnvironmentProvider();
            var settingsFiller       = new SettingsFiller(converterChooser, new Dictionary <string, IRawSettingsProvider> {
                { "func", funcSettingsProvider }, { "env", envSettingsProvider }
            }, funcSettingsProvider);

            return(settingsFiller);
        }