public async Task GenerateAnswerAsync_AnswerShouldMatchTheCheatAPIAnswer() { HttpClient client = new HttpClient(); DatasetAnswer answer = await _dealersAndVehiclesService.GenerateAnswerAsync(); var response = client.GetAsync($"http://api.coxauto-interview.com/api/{answer.DataSetId}/cheat").Result; Answer expectedResult = await response.Content.ReadAsAsync <Answer>(); Assert.IsTrue(expectedResult.dealers.OrderBy(i => i.dealerId).Select(i => i.dealerId) .SequenceEqual(answer.Answer.dealers.OrderBy(i => i.dealerId).Select(i => i.dealerId))); }
static void Main(string[] args) { ConfigureServices(); try { Console.WriteLine("Processing..."); //Generating Answer Task <DatasetAnswer> answer = dealersAndVehiclesService.GenerateAnswerAsync(); //Posting Answer Task <string> response = dealersAndVehiclesService.PostAnswerAsync(answer.Result.DataSetId, answer.Result.Answer); Console.Clear(); Console.WriteLine($"Program finished with the following message\n\n{ response.Result}\n"); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Press any key to exit"); Console.ReadKey(); }