public void beforeAll() { _keyPathProvider = Substitute.For <IKeyPathProvider>(); _keyPathProvider.GetKeyPath <TestConfigured>().Returns("TestConfigured"); _cut = new EnvironmentConfigurationSource(_keyPathProvider, new PropertyValueBinder()); }
// 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)); }
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))); }