public async Task Given_ServiceRequestEndpoint_When_PerformingGetRequestOnAllServiceRequests_Then_ReturnsSuccess() { using (var serviceRequestMgmtServer = new ServiceRequestManagementScenariosBase().CreateServer()) { var response = await serviceRequestMgmtServer .CreateClient() .GetAsync(Get.ServiceRequests); response.EnsureSuccessStatusCode(); } }
public async Task Given_PostCreateServiceRequestDTO_When_PerformingPostRequestToCreateServiceRequest_Then_ReturnsSuccess() { using (var serviceRequestMgmtServer = new ServiceRequestManagementScenariosBase().CreateServer()) { var requestBody = BuildPostCreateServiceRequestDTO(); var content = new StringContent(JsonConvert.SerializeObject(requestBody), Encoding.UTF8, "application/json"); var response = await serviceRequestMgmtServer .CreateClient() .PostAsync(Post.ServiceRequest, content); var responseContent = await response.Content.ReadAsStringAsync(); var actual = JsonConvert.DeserializeObject <ServiceRequestDTO>(responseContent); Assert.Equal(HttpStatusCode.Created, response.StatusCode); Assert.NotEqual(default, actual.Id);