예제 #1
0
            public void beforeAll()
            {
                _keyPathProvider = Substitute.For <IKeyPathProvider>();
                _keyPathProvider.GetKeyPath <TestConfigured>().Returns("TestConfigured");

                _cut = new EnvironmentConfigurationSource(_keyPathProvider, new PropertyValueBinder());
            }
예제 #2
0
        // Exposed for testing. Not on the interface.

        public FileInfo GetConfigurationFileInfo <T>(string suffix = ".json") where T : class, IConfigured, new()
        {
            var settingsFileName = _keyPathProvider.GetKeyPath <T>() + suffix;
            var settingsFilePath = Path.Combine(_settings.ConfigurationFilePath, settingsFileName);

            return(new FileInfo(settingsFilePath));
        }
예제 #3
0
        private IEnumerable <DictionaryEntry> ConfiguredEnvironmentEntries <T>() where T : class, IConfigured, new()
        {
            var keyPrefix = _keyPathProvider.GetKeyPath <T>();

            return(Environment.GetEnvironmentVariables()
                   .OfType <DictionaryEntry>()
                   .Where(entry => ((string)entry.Key).StartsWith(keyPrefix)));
        }