public void settings_are_loaded_from_json_file() { var provider = new JsonSettingsProvider("settings.json"); var settings = provider.Load(); Assert.AreEqual("1", settings["sample1"]); Assert.AreEqual("2", settings["sample2"]); }
public void an_exception_is_thrown_if_environment_not_found() { Assert.Throws<KeyNotFoundException>(() => { var provider = new JsonSettingsProvider("broken.settings.json"); provider.Load(); }); }
public void symbols_in_a_config_file_are_replaced_with_values_from_figs_config() { using (var stream = File.OpenRead("sample.config")) { var parser = new DefaultConfigurationParser(Encoding.ASCII); var provider = new JsonSettingsProvider("settings.json"); var settings = provider.Load(); var result = parser.Parse(stream, settings); Assert.AreEqual(File.ReadAllText("expected.config"), result); } }
public void an_exception_is_thrown_when_key_missing_from_figs_config() { Assert.Throws<KeyNotFoundException>(() => { using (var stream = File.OpenRead("missing.sample.config")) { var parser = new DefaultConfigurationParser(Encoding.ASCII); var provider = new JsonSettingsProvider("settings.json"); var settings = provider.Load(); parser.Parse(stream, settings); } }); }