Exemplo n.º 1
0
        public void TestToString()
        {
            const string html  = "a<img src=\"picture.gif\" alt=\"A Picture\">b";
            var          enc   = new ASCIIEncoding();
            var          bis   = new MemoryStream(enc.GetBytes(html));
            var          parse = new ReadHTML(bis);

            parse.ReadToTag();
            Assert.IsTrue(parse.ToString().IndexOf("A Picture") != -1);
        }
Exemplo n.º 2
0
        public void TestBoth()
        {
            const string html     = "<br/>";
            const string htmlName = "br";
            var          enc      = new ASCIIEncoding();
            var          bis      = new MemoryStream(enc.GetBytes(html));
            var          parse    = new ReadHTML(bis);

            Assert.IsTrue(parse.Read() == 0);
            Tag tag = parse.LastTag;

            Assert.IsNotNull(tag);
            Assert.IsTrue(tag.TagType == Tag.Type.Begin);
            Assert.IsTrue(tag.Name.Equals(htmlName));
            parse.ReadToTag();
            tag = parse.LastTag;
            Assert.IsNotNull(tag);
            Assert.IsTrue(tag.TagType == Tag.Type.End);
            Assert.IsTrue(tag.Name.Equals(htmlName));
        }