コード例 #1
0
        public async Task return_200_for_valid_request()
        {
            var fakeResponse = Fake.GenerateInspection(fakeId, fakeDescription);

            controller = SetupControllerWithServiceReturningFakeObject(fakeResponse);
            var response = await controller.GetInspection(fakeId.ToString());

            Assert.Equal((int)HttpStatusCode.OK, response.StatusCode);
        }
コード例 #2
0
        public async Task response_has_the_valid_format_if_request_successful()
        {
            var fakeResponse = Fake.GenerateInspection(fakeId, fakeDescription);

            controller = SetupControllerWithServiceReturningFakeObject(fakeResponse);
            var response = JObject.FromObject((await controller.GetInspection(fakeId.ToString())).Value);

            Assert.NotNull(response["results"]);
        }
コード例 #3
0
        public async Task response_has_valid_content_if_request_successful()
        {
            var fakeResponse = Fake.GenerateInspection(fakeId, fakeDescription);

            controller = SetupControllerWithServiceReturningFakeObject(fakeResponse);
            var response   = JObject.FromObject((await controller.GetInspection(fakeId.ToString())).Value);
            var responseId = response["results"][0]["Id"];
            var responseLocationDescription = response["results"][0]["LocationDescription"];

            Assert.Equal(fakeId, responseId);
            Assert.Equal(fakeDescription, responseLocationDescription);
        }