Exemplo n.º 1
0
        public void SpecificationTest4()
        {
            //测试中文标签和中文属性是否能够被识别
              var str = File.ReadAllText( Path.Combine( Environment.CurrentDirectory, "SpecificationTest4.html" ) );

              var contents = new JumonyReader( str ).EnumerateContent().ToArray();
              var beginTags = contents.OfType<HtmlBeginTag>().ToArray();
              var endTags = contents.OfType<HtmlEndTag>().ToArray();

              Assert.IsTrue( beginTags.Length >= 1, "无法解析中文名称标签" );
              Assert.IsTrue( beginTags.Length == 2, "无法解析中文名称属性" );
              Assert.AreEqual( endTags.Length, 2, "无法解析中文名称结束标签" );
        }
Exemplo n.º 2
0
    public void SpecificationTest4()
    {
      //测试中文标签和中文属性是否能够被识别
      var str = File.ReadAllText( Path.Combine( Environment.CurrentDirectory, "SpecificationTest4.html" ) );

      var contents = new JumonyReader( str ).EnumerateContent().ToArray();
      var beginTags = contents.OfType<HtmlBeginTag>().ToArray();
      var endTags = contents.OfType<HtmlEndTag>().ToArray();

      Assert.AreEqual( beginTags.Length, 1, "无法解析中文名称属性" );
      Assert.AreEqual( beginTags[0].Attributes.Count(), 1, "无法解析中文名称属性" );
      Assert.AreEqual( beginTags[0].Attributes.First().Name, "中文", "无法解析中文名称属性" );

    }
Exemplo n.º 3
0
        //[TestMethod] 这个测试已经过时。
        public void SpecificationTest3()
        {
            //测试各种异常标签是否不被识别
              var str = File.ReadAllText( Path.Combine( Environment.CurrentDirectory, "SpecificationTest3.html" ) );

              var contents = new JumonyReader( str ).EnumerateContent().ToArray();
              var tag = contents.OfType<HtmlBeginTag>().FirstOrDefault();
              Assert.IsNull( tag, string.Format( "找到不应当解析出来的标签 {0}", tag ) );
        }