Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
            }
        }