public async Task return_200_for_valid_request() { var fakeResponse = Fake.GenerateElement(fakeId, fakeDescription); controller = SetupControllerWithServiceReturningFakeObject(fakeResponse); var response = await controller.GetElement(fakeId.ToString()); Assert.Equal((int)HttpStatusCode.OK, response.StatusCode); }
public async Task response_has_valid_content_if_request_successful() { var fakeResponse = Fake.GenerateElement(fakeId, fakeDescription); controller = SetupControllerWithServiceReturningFakeObject(fakeResponse); var response = JObject.FromObject((await controller.GetElement(fakeId.ToString())).Value); var responseId = response["results"]["Id"].Value <int>(); var responseDescription = response["results"]["Description"]; Assert.Equal(fakeId, responseId); Assert.Equal(fakeDescription, responseDescription); }