public static void RetrieveResponseWithStatusCodeOk() { AboutControllersConfig.Register(GlobalConfiguration.Configuration); // Write code to allow the client to retrieve an HttpResponseMessage with a status code of 200 OK. using (var response = WebApiKoans.Client.GetAsync("http://go.com/api/aboutcontrollers").Result) Helpers.AssertEquality(HttpStatusCode.OK, response.StatusCode); #region Only used for testing GlobalConfiguration.Reset(); #endregion }
public static void RetrieveResponseWithContentHelloWorld() { AboutControllersConfig.Register(GlobalConfiguration.Configuration); // Write code to allow the client to retrieve an HttpResponseMessage with a status code of 200 OK // and a message body containing the string "Hello, world!". using (var response = WebApiKoans.Client.GetAsync("http://go.com/api/aboutcontrollers").Result) { var body = response.Content.ReadAsStringAsync().Result; Helpers.AssertEquality(HttpStatusCode.OK, response.StatusCode); Helpers.AssertEquality("Hello, world!", body); } #region Only used for testing GlobalConfiguration.Reset(); #endregion }