Async unit testing with NUnit and C#
问题 I have the following method I created it's nothing fancy just retrieves data from an HTTP server but it is an async method. public async Task<string> GetStringFromConsul(string key) { string s = ""; // attempts to get a string from Consul try { //async method to get the response HttpResponseMessage response = await this.http.GetAsync(apiPrefix + key); //if it responds successfully if (response.IsSuccessStatusCode) { //parse out a string and decode said string s = await response.Content