public void ReplaceAll(HtmlObject[] content) { HtmlElement parent = new HtmlElement("parent", new HtmlElement("element"), new HtmlAttribute("attribute1"), new HtmlAttribute("attribute2"), new HtmlComment("comment")); parent.ReplaceAll(content); Assert.Equal(content.OfType<HtmlElement>().ToArray(), parent.Elements().ToArray()); Assert.Equal(content.OfType<HtmlAttribute>().ToArray(), parent.Attributes().ToArray()); Assert.Equal(parent.Elements().Count() + parent.Attributes().Count(), parent.ElementsAndAttributes().Count()); Assert.Equal(parent.Nodes().Count() + parent.Attributes().Count(), parent.NodesAndAttributes().Count()); }
public void Ctor_String_ParamsHtmlObject(HtmlObject[] content) { HtmlElement element = new HtmlElement("element", content); Assert.Equal("element", element.Tag); Assert.False(element.IsVoid); Assert.Equal(content.OfType<HtmlElement>().ToArray(), element.Elements().ToArray()); Assert.Equal(content.OfType<HtmlAttribute>().ToArray(), element.Attributes().ToArray()); Assert.Equal(content.OfType<HtmlNode>().ToArray(), element.Nodes().ToArray()); Assert.Equal(element.Elements().Count() + element.Attributes().Count(), element.ElementsAndAttributes().Count()); Assert.Equal(content.Length, element.NodesAndAttributes().Count()); }