public void ParseReadableTests([ValueSource("_files")] string file) { var html = ReadFile(file); using (ApprovalResults.ForScenario(file)) { var output = HackerNewsParser.MapResults(html); Approvals.Verify(output.String); } }
public async Task <HackerNewsOutput> GetFrontpage(bool debug = false) { var uri = $"https://news.ycombinator.com/"; using (HttpClient httpclient = _httpFactory.CreateClient()) { using (HttpResponseMessage response = await httpclient.GetAsync(uri)) { response.EnsureSuccessStatusCode(); var result = await response.Content.ReadAsStringAsync(); if (debug) { await File.WriteAllTextAsync($@"D:\GitHub\web-cli\WebCLI\bin\Release\netcoreapp3.1\win10-x64\publish\hackernews_frontpage_debug.html", result); } return(HackerNewsParser.MapResults(result)); } } }