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.Equal(3, writer.Root.Children.Count); Assert.Equal(new [] { "george", "buzz", "hey" }, writer.Root.Children.Select(t => t.Name).ToArray()); Assert.NotNull(writer.Root.Children["buzz"]); Assert.NotNull(writer.Root["buzz"]); }
public void trivial_document() { PropertyTreeNodeWriter writer = new PropertyTreeNodeWriter(); writer.WriteStartDocument(); writer.WriteEndDocument(); Assert.Null(writer.Root); }
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.Equal(1, writer.Root.Children.Count); Assert.NotNull(writer.Root.Children["george"]); Assert.NotNull(writer.Root["george"]); Assert.Equal("burdell", writer.Root["george"].Value); }
public void document() { PropertyTreeNodeWriter writer = new PropertyTreeNodeWriter(); writer.WriteStartDocument(); writer.WriteStartTree("hello"); writer.WriteStartTree("george"); writer.WriteEndTree(); writer.WriteEndTree(); writer.WriteEndDocument(); Assert.Equal("hello", writer.Root.Name); Assert.Equal(1, writer.Root.Children.Count); Assert.Equal("george", writer.Root.Children[0].Name); Assert.NotNull(writer.Root.Children["george"]); Assert.NotNull(writer.Root["george"]); }