public void document3() { PropertyTreeNodeWriter writer = new PropertyTreeNodeWriter(); writer.WriteStartDocument(); writer.WriteStartTree("hello"); writer.WriteStartProperty("george"); writer.WritePropertyValue("burdell"); writer.WriteEndProperty(); writer.WriteStartProperty("buzz"); writer.WritePropertyValue("234"); writer.WriteEndProperty(); writer.WriteProperty("hey", "arnold"); writer.WriteEndTree(); writer.WriteEndDocument(); Assert.That(writer.Root.Children.Count, Is.EqualTo(3)); Assert.That(writer.Root.Children.Select(t => t.Name).ToArray(), Is.EquivalentTo(new [] { "george", "buzz", "hey" })); Assert.That(writer.Root.Children["buzz"], Is.Not.Null); Assert.That(writer.Root["buzz"], Is.Not.Null); }
public void document2() { PropertyTreeNodeWriter writer = new PropertyTreeNodeWriter(); writer.WriteStartDocument(); writer.WriteStartTree("hello"); writer.WriteStartProperty("george"); writer.WritePropertyValue("burdell"); writer.WriteEndProperty(); writer.WriteEndTree(); writer.WriteEndDocument(); Assert.That(writer.Root.Children.Count, Is.EqualTo(1)); Assert.That(writer.Root.Children["george"], Is.Not.Null); Assert.That(writer.Root["george"], Is.Not.Null); Assert.That(writer.Root["george"].Value, Is.EqualTo("burdell")); }