public void ParentConnections() { CreateParser("<custom>" + "<custom>something</custom>" + "</custom>"); parser.AddScanner(new CustomScanner(this, false)); parser.AddScanner(new AnotherScanner()); ParseAndAssertNodeCount(3); CustomTag customTag = (CustomTag)node[0]; AssertStringEquals("first custom tag html", "<CUSTOM></CUSTOM>", customTag.ToHtml()); Assert.IsNull(customTag.Parent, "first custom tag should have no parent"); customTag = (CustomTag)node[1]; AssertStringEquals("first custom tag html", "<CUSTOM>something</CUSTOM>", customTag.ToHtml()); Assert.IsNull(customTag.Parent, "second custom tag should have no parent"); Node firstChild = customTag[0]; AssertType("firstChild", typeof(StringNode), firstChild); CompositeTag parent = firstChild.Parent; Assert.IsNotNull(parent, "first child parent should not be null"); Assert.AreSame(customTag, parent, "parent and custom tag should be the same"); EndTag endTag = (EndTag)node[2]; AssertStringEquals("first custom tag html", "</CUSTOM>", endTag.ToHtml()); Assert.IsNull(endTag.Parent, "end tag should have no parent"); }
public void CompositeTagWithSelfChildren() { CreateParser("<custom>" + "<custom>something</custom>" + "</custom>"); parser.AddScanner(new CustomScanner(this, false)); parser.AddScanner(new AnotherScanner()); ParseAndAssertNodeCount(3); CustomTag customTag = (CustomTag)node[0]; int x = customTag.ChildCount; Assert.AreEqual(0, customTag.ChildCount, "child count"); Assert.IsFalse(customTag.EmptyXmlTag, "custom tag should not be xml end tag"); AssertStringEquals("first custom tag html", "<CUSTOM></CUSTOM>", customTag.ToHtml()); customTag = (CustomTag)node[1]; AssertStringEquals("first custom tag html", "<CUSTOM>something</CUSTOM>", customTag.ToHtml()); EndTag endTag = (EndTag)node[2]; AssertStringEquals("first custom tag html", "</CUSTOM>", endTag.ToHtml()); }