static void TestHtml(String source, Boolean openConsole) { var doc = TestHtml(source); if (openConsole) { var console = new HtmlSharpConsole(doc); console.Capture(); } }
static void TestHtmlFrom(String url, Boolean openConsole) { var sw = Stopwatch.StartNew(); var client = new HttpClient(); var result = client.GetAsync(url).Result; var source = result.Content.ReadAsStreamAsync().Result; sw.Stop(); Console.WriteLine("Loading " + url + " took ... " + sw.ElapsedMilliseconds + "ms"); sw.Restart(); var html = DocumentBuilder.Html(source); sw.Stop(); Console.WriteLine("Parsing " + url + " took ... " + sw.ElapsedMilliseconds + "ms"); if (openConsole) { var console = new HtmlSharpConsole(html); console.Capture(); } }
static void TestWebRequest(String url, Boolean openConsole) { var sw = Stopwatch.StartNew(); var client = new HttpClient(); var result = client.GetAsync(url).Result; var source = result.Content.ReadAsStreamAsync().Result; sw.Stop(); Console.WriteLine("Loading " + url + " took ... " + sw.ElapsedMilliseconds + "ms"); sw.Restart(); var html = DocumentBuilder.Html(source); sw.Stop(); Console.WriteLine("Parsing " + url + " took ... " + sw.ElapsedMilliseconds + "ms"); if (openConsole) { var console = new HtmlSharpConsole(html); console.Capture(); } }