public async Task Should_leave_private_consultation_with_valid_conference_and_room_type() { var conferenceId = TestConference.Id; var participant = TestConference.GetParticipants()[1]; var leaveConsultationRequest = new LeaveConsultationRequest { ConferenceId = conferenceId, ParticipantId = participant.Id }; await Controller.LeaveConsultationAsync(leaveConsultationRequest); QueryHandlerMock.Verify(q => q.Handle <GetConferenceByIdQuery, VideoApi.Domain.Conference>(It.IsAny <GetConferenceByIdQuery>()), Times.Once); ConsultationServiceMock.Verify(v => v.LeaveConsultationAsync(TestConference.Id, leaveConsultationRequest.ParticipantId, participant.GetCurrentRoom(), RoomType.WaitingRoom.ToString()), Times.Once); ConsultationServiceMock.VerifyNoOtherCalls(); }
public async Task Should_not_transfer_participant_when_consultation_is_not_accepted() { var conferenceId = TestConference.Id; var participant = TestConference.GetParticipants()[3]; var roomFrom = participant.GetCurrentRoom(); var request = new ConsultationRequestResponse { ConferenceId = conferenceId, RequestedFor = participant.Id, RoomLabel = "ConsultationRoom", Answer = ConsultationAnswer.Rejected }; await Controller.RespondToConsultationRequestAsync(request); ConsultationServiceMock.Verify(x => x.LeaveConsultationAsync(conferenceId, participant.Id, roomFrom, request.RoomLabel), Times.Never); ConsultationServiceMock.VerifyNoOtherCalls(); }
public async Task Should_transfer_participant_when_consultation_is_accepted() { var conferenceId = TestConference.Id; var participant = TestConference.GetParticipants()[3]; var requestedBy = TestConference.GetParticipants()[1]; var request = new ConsultationRequestResponse { ConferenceId = conferenceId, RequestedBy = requestedBy.Id, RequestedFor = participant.Id, RoomLabel = "ConsultationRoom", Answer = ConsultationAnswer.Accepted }; await Controller.RespondToConsultationRequestAsync(request); ConsultationServiceMock.Verify(x => x.ParticipantTransferToRoomAsync(conferenceId, participant.Id, request.RoomLabel), Times.Once); ConsultationServiceMock.VerifyNoOtherCalls(); }
public async Task Should_raise_notification_to_requester_and_admin_when_consultation_is_accepted() { var conferenceId = TestConference.Id; var requestedBy = TestConference.GetParticipants()[2]; var requestedFor = TestConference.GetParticipants()[3]; var answer = ConsultationAnswer.Accepted; var request = new ConsultationRequestResponse { ConferenceId = conferenceId, RequestedBy = requestedBy.Id, RequestedFor = requestedFor.Id, Answer = answer, RoomLabel = "Room1" }; await Controller.RespondToConsultationRequestAsync(request); CommandHandlerMock.Verify(x => x.Handle(It.Is <SaveEventCommand>(s => s.Reason == $"Adding {requestedFor.DisplayName} to {request.RoomLabel}")), Times.Once); ConsultationServiceMock.Verify(x => x.ParticipantTransferToRoomAsync(TestConference.Id, requestedFor.Id, "Room1"), Times.Once); ConsultationServiceMock.VerifyNoOtherCalls(); }