public void CompositeTagWithDeadlock() { CreateParser("<custom>" + "<another>something" + "</custom>" + "<custom>" + "<another>else</another>" + "</custom>"); parser.AddScanner(new AnotherScanner(true)); CustomTag customTag = ParseCustomTag(2); int x = customTag.ChildCount; Assert.AreEqual(1, customTag.ChildCount, "child count"); Assert.IsFalse(customTag.EmptyXmlTag, "custom tag should not be xml end tag"); Assert.AreEqual(0, customTag.StartTag.ElementBegin, "starting loc"); Assert.AreEqual(7, customTag.StartTag.ElementEnd, "ending loc"); Assert.AreEqual(1, customTag.tagData.StartLine, "starting line position"); Assert.AreEqual(1, customTag.tagData.EndLine, "ending line position"); AnotherTag anotherTag = (AnotherTag)customTag[0]; Assert.AreEqual(1, anotherTag.ChildCount, "anotherTag child count"); StringNode stringNode = (StringNode)anotherTag[0]; AssertStringEquals("anotherTag child text", "something", stringNode.ToPlainTextString()); AssertStringEquals("first custom tag html", "<CUSTOM><ANOTHER>something</ANOTHER></CUSTOM>", customTag.ToHtml()); customTag = (CustomTag)node[1]; AssertStringEquals("second custom tag html", "<CUSTOM><ANOTHER>else</ANOTHER></CUSTOM>", customTag.ToHtml()); }
public void CompositeTagWithNestedTag() { CreateParser("<Custom>" + "<Another>" + "Hello" + "</Another>" + "<Custom/>" + "</Custom>" + "<Custom/>"); parser.AddScanner(new CustomScanner(this)); parser.AddScanner(new AnotherScanner()); ParseAndAssertNodeCount(2); AssertType("first node", typeof(CustomTag), this.node[0]); AssertType("second node", typeof(CustomTag), this.node[1]); CustomTag customTag = (CustomTag)this.node[0]; Node node = customTag[0]; AssertType("first child", typeof(AnotherTag), node); AnotherTag anotherTag = (AnotherTag)node; Assert.AreEqual(1, anotherTag.ChildCount, "another tag children count"); node = anotherTag[0]; AssertType("nested child", typeof(StringNode), node); StringNode text = (StringNode)node; Assert.AreEqual("Hello", text.ToPlainTextString(), "text"); }