public void Should_map_all_properties(Participant participant) { participant.UpdateParticipantStatus(ParticipantState.Available); var response = ParticipantToSummaryResponseMapper.MapParticipantToSummary(participant); response.Should().BeEquivalentTo(participant, options => options .Excluding(x => x.ParticipantRefId) .Excluding(x => x.DisplayName) .Excluding(x => x.Name) .Excluding(x => x.UserRole) .Excluding(x => x.Id) .Excluding(x => x.CaseTypeGroup) .Excluding(x => x.Representee) .Excluding(x => x.TestCallResultId) .Excluding(x => x.TestCallResult) .Excluding(x => x.CurrentRoom) .Excluding(x => x.State) ); response.Status.Should().BeEquivalentTo(participant.State); response.Status.Should().BeEquivalentTo(participant.GetCurrentStatus().ParticipantState); if (participant.UserRole == UserRole.Individual || participant.UserRole == UserRole.Representative) { response.CaseGroup.Should().Be(participant.CaseTypeGroup); } else { response.CaseGroup.Should().BeEmpty(); } }
public void Should_map_all_properties(Participant participant) { participant.UpdateParticipantStatus(ParticipantState.Available); var response = ParticipantToSummaryResponseMapper.MapParticipantToSummary(participant); response.Should().BeEquivalentTo(participant, options => options .Excluding(x => x.ParticipantRefId) .Excluding(x => x.DisplayName) .Excluding(x => x.Name) .Excluding(x => x.UserRole) .Excluding(x => x.Id) .Excluding(x => x.CaseTypeGroup) .Excluding(x => x.Representee) .Excluding(x => x.TestCallResultId) .Excluding(x => x.TestCallResult) .Excluding(x => x.CurrentRoom) .Excluding(x => x.CurrentConsultationRoomId) .Excluding(x => x.CurrentConsultationRoom) .Excluding(x => x.State) .Excluding(x => x.LinkedParticipants) .Excluding(x => x.RoomParticipants) ); response.Status.Should().BeEquivalentTo(participant.State); response.Status.Should().BeEquivalentTo(participant.GetCurrentStatus().ParticipantState); response.CaseGroup.Should().Be(participant.CaseTypeGroup); }
public async Task <IActionResult> GetParticipantsByConferenceId(Guid conferenceId) { _logger.LogDebug("GetParticipantsByConferenceId"); var query = new GetConferenceByIdQuery(conferenceId); var conference = await _queryHandler.Handle <GetConferenceByIdQuery, Conference>(query); if (conference == null) { _logger.LogWarning("Unable to find conference"); return(NotFound()); } var participants = conference.Participants.Select(x => ParticipantToSummaryResponseMapper.MapParticipantToSummary(x)).ToList(); return(Ok(participants)); }
public async Task <IActionResult> GetParticipantsByConferenceId(Guid conferenceId) { _logger.LogDebug("GetParticipantsByConferenceId"); var query = new GetConferenceByIdQuery(conferenceId); var conference = await _queryHandler.Handle <GetConferenceByIdQuery, Conference>(query); if (conference == null) { _logger.LogWarning("Unable to find conference"); return(NotFound()); } var participantRooms = conference.Rooms.OfType <ParticipantRoom>().ToList(); var participants = conference.Participants.Select(x => { var participantRoom = participantRooms.SingleOrDefault(r => r.DoesParticipantExist(new RoomParticipant(x.Id))); return(ParticipantToSummaryResponseMapper.MapParticipantToSummary(x, participantRoom)); }).ToList(); return(Ok(participants)); }