public async Task TestCheckReplies1() { // Perform API call CheckRepliesResponse result = null; try { result = await controller.GetCheckRepliesAsync(); } catch (APIException apiException) { Assert.IsEmpty(apiException.Message); }; // Test response code Assert.AreEqual(200, httpCallBackHandler.Response.StatusCode, "Status should be 200"); // Test headers Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("Content-Type", null); Assert.IsTrue(TestHelper.AreHeadersProperSubsetOf( headers, httpCallBackHandler.Response.Headers), "Headers should match"); // Test whether the captured response is as we expected Assert.IsNotNull(result, "Result should exist"); // Note, since we're testing the actual replies for our test account, we should be safe to test the empty replies Assert.IsTrue(TestHelper.ConvertStreamToString(httpCallBackHandler.Response.RawBody).StartsWith("{\"replies\":["), "Response body should match exactly (string literal match)"); }
public async Task TestCheckReplies1() { // Perform API call Messages.Models.CheckRepliesResponse result = null; try { result = await controller.GetCheckRepliesAsync(); } catch (APIException) {}; // Test response code Assert.AreEqual(200, httpCallBackHandler.Response.StatusCode, "Status should be 200"); // Test headers Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("Content-Type", null); Assert.IsTrue(TestHelper.AreHeadersProperSubsetOf( headers, httpCallBackHandler.Response.Headers), "Headers should match"); // Test whether the captured response is as we expected Assert.IsNotNull(result, "Result should exist"); Assert.AreEqual("{ \"replies\": [ { \"metadata\": { \"key1\": \"value1\", \"key2\": \"value2\" }, \"message_id\": \"877c19ef-fa2e-4cec-827a-e1df9b5509f7\", \"reply_id\": \"a175e797-2b54-468b-9850-41a3eab32f74\", \"date_received\": \"2016-12-07T08:43:00.850Z\", \"callback_url\": \"https://my.callback.url.com\", \"destination_number\": \"+61491570156\", \"source_number\": \"+61491570157\", \"vendor_account_id\": { \"vendor_id\": \"MessageMedia\", \"account_id\": \"MyAccount\" }, \"content\": \"My first reply!\" }, { \"metadata\": { \"key1\": \"value1\", \"key2\": \"value2\" }, \"message_id\": \"8f2f5927-2e16-4f1c-bd43-47dbe2a77ae4\", \"reply_id\": \"3d8d53d8-01d3-45dd-8cfa-4dfc81600f7f\", \"date_received\": \"2016-12-07T08:43:00.850Z\", \"callback_url\": \"https://my.callback.url.com\", \"destination_number\": \"+61491570157\", \"source_number\": \"+61491570158\", \"vendor_account_id\": { \"vendor_id\": \"MessageMedia\", \"account_id\": \"MyAccount\" }, \"content\": \"My second reply!\" } ]}", TestHelper.ConvertStreamToString(httpCallBackHandler.Response.RawBody), "Response body should match exactly (string literal match)"); }