public void Should_map_all_properties_with_not_matching_booking_participants() { var conferenceId = Guid.NewGuid(); var conference = CreateValidConference(conferenceId); var judge1 = CreateParticipant("judge1"); var judge2 = CreateParticipant("judge2"); var judge3 = CreateParticipant("judge3"); var judge3DifferentHearing = CreateParticipant("judge3"); conference.Participants = new List <Participant> { judge1, judge2, judge3 }; var judgesInHearings = new List <JudgeInHearingResponse> { new JudgeInHearingResponse { Id = judge3DifferentHearing.Id, Username = judge3.Username, Status = ParticipantState.InHearing } }; var results = ParticipantStatusResponseForVhoMapper .MapParticipantsTo(conference, judgesInHearings).ToList(); AssertResponseItem(results.ElementAt(0), conference.Participants[0], conferenceId, false); }
public async Task <IActionResult> GetParticipantsWithContactDetailsByConferenceIdAsync(Guid conferenceId) { _logger.LogDebug("GetParticipantsWithContactDetailsByConferenceId"); if (conferenceId == Guid.Empty) { _logger.LogWarning("Unable to get conference when id is not provided"); ModelState.AddModelError(nameof(conferenceId), $"Please provide a valid {nameof(conferenceId)}"); return(BadRequest(ModelState)); } try { var conference = await _conferenceCache.GetOrAddConferenceAsync(conferenceId, () => { _logger.LogTrace($"Retrieving conference details for conference: ${conferenceId}"); return(_videoApiClient.GetConferenceDetailsByIdAsync(conferenceId)); }); _logger.LogTrace($"Retrieving booking participants for hearing ${conference.HearingId}"); var judgesInHearingsToday = await _videoApiClient.GetJudgesInHearingsTodayAsync(); var response = ParticipantStatusResponseForVhoMapper.MapParticipantsTo(conference, judgesInHearingsToday); return(Ok(response)); } catch (VideoApiException ex) { _logger.LogError(ex, $"Unable to retrieve conference: ${conferenceId}"); return(StatusCode(ex.StatusCode, ex.Response)); } catch (BookingsApiException ex) { _logger.LogError(ex, $"Unable to retrieve booking participants from hearing with conferenceId: ${conferenceId}"); return(StatusCode(ex.StatusCode, ex.Response)); } }