コード例 #1
0
        public void CompositeTagWithAnotherTagChild()
        {
            CreateParser("<Custom>" + "<Another/>" + "</Custom>");
            parser.AddScanner(new AnotherScanner());
            CustomTag customTag = ParseCustomTag(1);
            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(0, customTag.ElementBegin, "custom tag starting loc");
            Assert.AreEqual(26, customTag.ElementEnd, "custom tag ending loc");

            Node child = customTag[0];

            AssertType("child", typeof(AnotherTag), child);
            AnotherTag tag = (AnotherTag)child;

            Assert.AreEqual(8, tag.ElementBegin, "another tag start pos");
            Assert.AreEqual(17, tag.ElementEnd, "another tag ending pos");

            Assert.AreEqual(18, customTag.EndTag.ElementBegin, "custom end tag start pos");
            AssertStringEquals("child html", "<ANOTHER/>", child.ToHtml());
        }
コード例 #2
0
        public void CompositeTagWithTagChild()
        {
            CreateParser("<Custom>" + "<Hello>" + "</Custom>");
            CustomTag customTag = ParseCustomTag(1);
            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(0, customTag.ElementBegin, "custom tag starting loc");
            Assert.AreEqual(23, customTag.ElementEnd, "custom tag ending loc");

            Node child = customTag[0];

            AssertType("child", typeof(Tag), child);
            Tag tag = (Tag)child;

            AssertStringEquals("child html", "<HELLO>", child.ToHtml());
        }