示例#1
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));
        }
示例#2
0
 void Init_Value_Control(Song Item_Song)
 {
     if (Item_Song.Online == true)
     {
         Item_Song        = ReadHTML.GetMoreSongInfo(Item_Song);
         Item_Song.Online = false;
     }
     Text_TB.Text           = "";
     Slider_Time.Value      = 0;
     NameOfSongPlayingNow   = Item_Song.Name_Song;
     NameOfArtistPlayingNow = Item_Song.Name_Artist;
     if (Item_Song.Image_Song == null)
     {
         Image_NowPlaying = new System.Windows.Media.Imaging.BitmapImage(new Uri(Picture.NHAC_OFFLINE));
     }
     else
     {
         Image_NowPlaying = new System.Windows.Media.Imaging.BitmapImage(new Uri(Item_Song.Image_Song));
     }
     Lyric = Item_Song.Lyric_Song;
 }
示例#3
0
        public void TestAttributeLess()
        {
            const string html = "12<b>12</b>1";
            var          enc  = new ASCIIEncoding();
            var          bis  = new MemoryStream(enc.GetBytes(html));

            var parse = new ReadHTML(bis);

            Assert.IsTrue(parse.Read() == '1');
            Assert.IsTrue(parse.Read() == '2');
            Assert.IsTrue(parse.Read() == 0);
            Assert.IsTrue(parse.LastTag.Name.Equals("b"));
            Assert.IsTrue(parse.LastTag.TagType == Tag.Type.Begin);
            Assert.IsTrue(parse.Read() == '1');
            Assert.IsTrue(parse.Read() == '2');
            Assert.IsTrue(parse.Read() == 0);
            Tag tag = parse.LastTag;

            Assert.IsTrue(tag.Name.Equals("b"));
            Assert.IsTrue(tag.TagType == Tag.Type.End);
            Assert.AreEqual(tag.ToString(), "</b>");
            Assert.IsTrue(parse.Read() == '1');
        }