public void TestParsePageFinancial() { String srcDir = @"C:\htmldwl\"; PageFinancial page = new PageFinancial(); String path = srcDir + page.getFileName("2379", 108, 1); if (File.Exists(path) == false) { String content = page.download_page(page.getPageUrl("2379", 108, 1), "2379", 108, 1); using (StreamWriter sw = new StreamWriter(path, false, Encoding.GetEncoding("big5"))) { sw.Write(content); sw.Close(); } } using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("big5"))) { BsonDocument res = page.ParseHtml(sr.ReadToEnd()); } Assert.Pass(); }
public void TestMongoConnection() { DbMongo mongo = new DbMongo(); mongo.connect(); PageFinancial page = new PageFinancial(); String path = @"C:\Temp\htmldwl\" + page.getFileName("2379", 108, 1); using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("utf-8"))) { BsonDocument financial = page.ParseHtml(sr.ReadToEnd()); mongo.FinancialReport_save(financial, "2379", 108, 1); } }