Пример #1
0
        public async Task TestAllContents1()
        {
            // Perform API call
            Standard.Models.AllContentsResponse result = null;

            try
            {
                result = await controller.AllContentsAsync();
            }
            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("{  \"Result\": {    \"Status\": \"Success\",    \"Message\": \"\"  },  \"IPAddresses\": [    [      \"884d9804999fc47a3c2694e49ad2536a\",      \"192.168.100.14/24\"    ]  ],  \"GeoLocations\": [    \"884d9804999fc47a3c2694e49ad2536a#CA\"  ]}",
                            TestHelper.ConvertStreamToString(httpCallBackHandler.Response.RawBody),
                            "Response body should match exactly (string literal match)");
        }