public void Should_map_all_properties() { var hearing = new CreateHearingRequestBuilder().Build(); var hearingResponse = new HearingsResponseBuilder(hearing).Build(); var bookingsResponse = new BookingsHearingResponseBuilder(hearingResponse).Build(); var response = HearingResponseMapper.Map(bookingsResponse); response.Should().BeEquivalentTo(bookingsResponse, options => options.ExcludingMissingMembers()); }
public async Task <IActionResult> GetAllHearingsByCreatedBy(string createdBy) { _logger.LogDebug("GetAllHearingsByCreatedBy {createdBy}"); try { var allHearingsResponse = await _testApiClient.GetAllHearingsAsync(); _logger.LogDebug("Retrieved {count} hearings in total.", allHearingsResponse.Count); var hearings = (from hearing in allHearingsResponse where hearing.CreatedBy.ToLower().Equals(createdBy.ToLower()) select HearingResponseMapper.Map(hearing)).ToList(); _logger.LogDebug("Filtered down to {count} hearings in total created by '{createdBy}'.", hearings.Count, createdBy); return(Ok(hearings)); } catch (TestApiException e) { _logger.LogError(e, "Unable to fetch hearings with error '{message}'", e.Message); return(StatusCode(e.StatusCode, e.Response)); } }