Пример #1
0
 public void ReadSite2()
 {
     HtmlWeb webClient = new HtmlWeb();
     //国际名校公开课 http://open.163.com/ocw/
     Task<HtmlDocument> doc = webClient.LoadFromWebAsync("http://localhost:8080/OpenCourse163Test.html");//http://open.163.com/ocw/
     HtmlDocument docNode = doc.Result;
     HtmlNode node = docNode.DocumentNode;
     // 1.<div class="m-t-bg">...</div>
     Client client = new Client();
     List<Catalogue> catalogues = client.GetCatalogueList(node);
     printCatalogues(catalogues);
     //断言
     Assert.AreEqual(18, catalogues.Count());
 }
Пример #2
0
 public void ReadSite3()
 {
     Client client = new Client();
     Task<All> alltask = client.GetAllSet();
     All all = alltask.Result;
     foreach(var cs in all.NewCatalogueSet)
     {
         System.Diagnostics.Debug.WriteLine("NewCatalogueSet ID {0}\t Title {1}",cs.ID,cs.Title);
     }
     foreach (var nct in all.newCourseTypeSet)
     {
         System.Diagnostics.Debug.WriteLine("NewCatalogueSet ID {0}\t Title {1} CatalogueTitle {2}",
             nct.ID, nct.Title, nct.Catalogue.Title);
     }
     foreach(var ncs in all.NewCourseSet)
     {
         System.Diagnostics.Debug.WriteLine("CourseTitle {0}  CourseType {1}", ncs.CourseTitle, ncs.CourseType.Title);
     }
     Assert.AreEqual(3, all.NewCatalogueSet.Count());
     Assert.AreEqual(18, all.newCourseTypeSet.Count());
     Assert.AreEqual(237, all.NewCourseSet.Count());
 }
Пример #3
0
        public async  Task GetData()
        {
            Client client = new Client();
            all = await client.GetAllSet();
            bind(all);

        }