public void StructuredProperties() { StringBuilder sb = new StringBuilder(); sb.AppendLine("test.me = pass"); sb.AppendLine("test.two = ed"); sb.AppendLine("stress.it.to.the.max = 200"); sb.AppendLine("stress.it.again = 23d"); ConfigSource source = new ConfigSource(); source.LoadProperties(GetStream(sb)); Assert.AreEqual(2, source.GetChild("test").Keys.Length); Assert.AreEqual("ed", source.GetChild("test").GetString("two")); }
public void LoadProperties() { StringBuilder sb = new StringBuilder(); sb.AppendLine("test=23"); sb.AppendLine("test.foo=12"); sb.AppendLine("test.bar=test"); Stream input = new MemoryStream(Encoding.UTF8.GetBytes(sb.ToString())); ConfigSource config = new ConfigSource(); config.LoadProperties(input); Assert.AreEqual(1, config.Keys.Length); Assert.AreEqual("test", config.Keys[0]); Assert.AreEqual(2, config.GetChild("test").Keys.Length); Assert.AreEqual("foo", config.GetChild("test").Keys[0]); Assert.AreEqual("bar", config.GetChild("test").Keys[1]); Assert.AreEqual(12, config.GetChild("test").GetInt32("foo")); Assert.AreEqual("test", config.GetChild("test").GetString("bar")); }