예제 #1
0
        public Guid CreateTestReport(Guid projectWatcherId, TestSummary testSummary, IReadOnlyList <TestDetail> testDetails)
        {
            var request = _createTestReportDtoMapper.Map(testSummary, testDetails);

            var responseMessage = _httpClient.Post(_jsonService, ApiUrlHelper.GetCreateTestReportUrl(projectWatcherId), request);

            if (responseMessage.IsSuccessStatusCode)
            {
                _logger.LogInformation("Api accepted the request");

                var responseText = responseMessage.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                var result       = _jsonService.Deserialize <CreateTestReportResponseDto>(responseText);

                return(result.ReportId);
            }

            throw new Exception("Api failed to accept the request.");
        }