public virtual void NodeIsNotASiblingOfItself() { Document doc = iText.StyledXmlParser.Jsoup.Jsoup.Parse("<div><p>One<p>Two<p>Three</div>"); iText.StyledXmlParser.Jsoup.Nodes.Element p2 = doc.Select("p")[1]; NUnit.Framework.Assert.AreEqual("Two", p2.Text()); IList <iText.StyledXmlParser.Jsoup.Nodes.Node> nodes = p2.SiblingNodes(); NUnit.Framework.Assert.AreEqual(2, nodes.Count); NUnit.Framework.Assert.AreEqual("<p>One</p>", nodes[0].OuterHtml()); NUnit.Framework.Assert.AreEqual("<p>Three</p>", nodes[1].OuterHtml()); }
public virtual void OrphanNodeReturnsNullForSiblingElements() { iText.StyledXmlParser.Jsoup.Nodes.Node node = new iText.StyledXmlParser.Jsoup.Nodes.Element(iText.StyledXmlParser.Jsoup.Parser.Tag .ValueOf("p"), ""); iText.StyledXmlParser.Jsoup.Nodes.Element el = new iText.StyledXmlParser.Jsoup.Nodes.Element(iText.StyledXmlParser.Jsoup.Parser.Tag .ValueOf("p"), ""); NUnit.Framework.Assert.AreEqual(0, node.SiblingIndex()); NUnit.Framework.Assert.AreEqual(0, node.SiblingNodes().Count); NUnit.Framework.Assert.IsNull(node.PreviousSibling()); NUnit.Framework.Assert.IsNull(node.NextSibling()); NUnit.Framework.Assert.AreEqual(0, el.SiblingElements().Count); NUnit.Framework.Assert.IsNull(el.PreviousElementSibling()); NUnit.Framework.Assert.IsNull(el.NextElementSibling()); }