public void Should_Throw_On_FileNotFound() { var configurationSource = new TextFileConfigurationSource("missing.txt", DefaultSeparator); var configurationProvider = new TextFileConfigurationProvider(configurationSource); Check.ThatCode(() => configurationProvider.Load()).ThrowsType(typeof(FileNotFoundException)); }
public void Should_Throw_On_InvalidPath(string path) { var configurationSource = new TextFileConfigurationSource(path, DefaultSeparator); var configurationProvider = new TextFileConfigurationProvider(configurationSource); Check.ThatCode(() => configurationProvider.Load()).ThrowsType(typeof(ArgumentException)); }
public void Should_Handle_Custom_Separator(string key, string expectedValue) { var configurationSource = new TextFileConfigurationSource(DefaultPath, '.'); var configurationProvider = new TextFileConfigurationProvider(configurationSource); configurationProvider.Load(); configurationProvider.TryGet(key, out var value); Check.That(value).Equals(expectedValue); }
public void Should_Load_Configuration_From_File(string key, string expectedValue) { var configurationSource = new TextFileConfigurationSource(DefaultPath, DefaultSeparator); var configurationProvider = new TextFileConfigurationProvider(configurationSource); configurationProvider.Load(); configurationProvider.TryGet(key, out var value); Check.That(value).Equals(expectedValue); }