示例#1
0
 public void TestRegexSelector()
 {
     Html selectable = new Html("aaaaaaab","");
     //        Assert.assertEquals("abbabbab", (selectable.regex("(.*)").replace("aa(a)", "$1bb").toString()));
     string value = selectable.Regex("(.*)").Replace("aa(a)", "$1bb").ToString();
     Assert.AreEqual("abbabbab", value);
 }
示例#2
0
 public void TestChain()
 {
     Html selectable = new Html(_html,"");
     IList<string> linksWithoutChain = selectable.Links().GetAll();
     ISelectable xpath = selectable.XPath("//div");
     IList<string> linksWithChainFirstCall = xpath.Links().GetAll();
     IList<string> linksWithChainSecondCall = xpath.Links().GetAll();
     Assert.AreEqual(linksWithoutChain.Count, linksWithChainFirstCall.Count);
     Assert.AreEqual(linksWithChainFirstCall.Count, linksWithChainSecondCall.Count);
 }
示例#3
0
 public void SetHtml(Html html)
 {
     _html = html;
 }
示例#4
0
 /// <summary>
 /// Get html content of page
 /// </summary>
 /// <returns></returns>
 public Html GetHtml()
 {
     return _html ?? (_html = new Html(_rawText, _request.Url));
 }
示例#5
0
 public void TestNodes()
 {
     Html selectable = new Html(_html,"");
     IList<ISelectable> links = selectable.XPath("//a").Nodes();
     Assert.AreEqual(links[0].Links().Value, "http://whatever.com/aaa");
 }