public void SimpleProperties() { StringBuilder sb = new StringBuilder(); sb.AppendLine("test=passed"); sb.AppendLine("me=spaced value"); ConfigSource source = new ConfigSource(); source.LoadProperties(GetStream(sb)); Assert.AreEqual("test", source.Keys[0]); Assert.AreEqual("me", source.Keys[1]); Assert.AreEqual("passed", source.GetString("test")); Assert.AreEqual("spaced value", source.GetString("me")); }
public void TestString() { ConfigSource config = new ConfigSource(); config.SetValue("key", "value"); Assert.AreEqual("value", config.GetString("key")); }
private static void SetChildValues(Util.Properties properties, string prefix, ConfigSource config) { prefix += config.Name; foreach (string key in config.Keys) { string value = config.GetString(key, null); if (String.IsNullOrEmpty(value)) { continue; } properties.SetProperty(prefix + "." + key, value); } foreach (ConfigSource child in config.Children) { SetChildValues(properties, prefix, child); } }