public GetKeys ( ConfigurationLevel level ) : IEnumerable |
||
level | ConfigurationLevel | |
Результат | IEnumerable |
public static void LoadProperties() { var stream = CreatePropertiesStreamToLoad(); var dbConfig = new Configuration(); dbConfig.Load(stream, new PropertiesConfigurationFormatter()); Assert.AreEqual(2, dbConfig.GetKeys().Count()); var firstSetting = dbConfig.GetValue("first-setting"); Assert.IsNotNull(firstSetting); Assert.IsInstanceOf<string>(firstSetting); Assert.AreEqual("one", firstSetting); var secondSetting = dbConfig.GetValue("second"); Assert.IsNotNull(secondSetting); Assert.IsInstanceOf<string>(secondSetting); Assert.AreEqual("345.33", secondSetting); }
public void LoadProperties() { var dbConfig = new Configuration(); var path = Path.Combine(Environment.CurrentDirectory, FileName); using (var source = new FileConfigurationSource(path)) { dbConfig.Load(source, new PropertiesConfigurationFormatter()); } Assert.AreEqual(2, dbConfig.GetKeys().Count()); var firstSetting = dbConfig.GetValue("first-setting"); Assert.IsNotNull(firstSetting); Assert.IsInstanceOf<string>(firstSetting); Assert.AreEqual("one", firstSetting); var secondSetting = dbConfig.GetValue("second"); Assert.IsNotNull(secondSetting); Assert.IsInstanceOf<string>(secondSetting); Assert.AreEqual("345.33", secondSetting); }
public static void LoadProperties() { var stream = CreatePropertiesStreamToLoad(); var dbConfig = new Configuration(); dbConfig.Load(stream, new PropertiesConfigurationFormatter()); Assert.AreEqual(2, dbConfig.GetKeys().Count()); var firstSetting = dbConfig.GetValue("first-setting"); Assert.IsNotNull(firstSetting); Assert.IsInstanceOf <string>(firstSetting); Assert.AreEqual("one", firstSetting); var secondSetting = dbConfig.GetValue("second"); Assert.IsNotNull(secondSetting); Assert.IsInstanceOf <string>(secondSetting); Assert.AreEqual("345.33", secondSetting); }
public void LoadFromFile_Properties() { var filePath = Path.Combine(Environment.CurrentDirectory, "db.config"); var config = new Configuration(); using (var source = new FileConfigurationSource(filePath)) { config.Load(source, new PropertiesConfigurationFormatter()); } Assert.AreEqual(2, config.Count()); var keys = config.GetKeys().ToArray(); Assert.IsNotEmpty(keys); Assert.AreEqual("system.configKey", keys.First()); var configValue = config.GetValue("db.name"); Assert.IsNotNull(configValue); Assert.IsInstanceOf <string>(configValue); Assert.AreEqual("testdb", (string)configValue); }
public void LoadProperties() { var dbConfig = new Configuration(); var path = Path.Combine(Environment.CurrentDirectory, FileName); using (var source = new FileConfigurationSource(path)) { dbConfig.Load(source, new PropertiesConfigurationFormatter()); } Assert.AreEqual(2, dbConfig.GetKeys().Count()); var firstSetting = dbConfig.GetValue("first-setting"); Assert.IsNotNull(firstSetting); Assert.IsInstanceOf <string>(firstSetting); Assert.AreEqual("one", firstSetting); var secondSetting = dbConfig.GetValue("second"); Assert.IsNotNull(secondSetting); Assert.IsInstanceOf <string>(secondSetting); Assert.AreEqual("345.33", secondSetting); }
public void LoadFromFile_Properties() { var filePath = Path.Combine(Environment.CurrentDirectory, "db.config"); var config = new Configuration(); using (var source = new FileConfigurationSource(filePath)) { config.Load(source, new PropertiesConfigurationFormatter()); } Assert.AreEqual(2, config.Count()); var keys = config.GetKeys().ToArray(); Assert.IsNotEmpty(keys); Assert.AreEqual("system.configKey", keys.First()); var configValue = config.GetValue("db.name"); Assert.IsNotNull(configValue); Assert.IsInstanceOf<string>(configValue); Assert.AreEqual("testdb", (string)configValue); }