public void should_return_interpreter_when_participant_is_in_an_interpreter_room()
        {
            var conferenceId = Guid.NewGuid();
            var participant  = new ParticipantBuilder().WithUserRole(UserRole.Individual)
                               .WithCaseTypeGroup("Applicant")
                               .Build();
            var consultationRoom = new ConsultationRoom(conferenceId, "ConsultationRoom1",
                                                        VirtualCourtRoomType.Participant, false);

            consultationRoom.SetProtectedProperty(nameof(consultationRoom.Id), 998);

            var interpreterRoom = new ParticipantRoom(conferenceId, "Interpreter1", VirtualCourtRoomType.Civilian);

            interpreterRoom.SetProtectedProperty(nameof(interpreterRoom.Id), 999);

            var consultationRoomParticipant = new RoomParticipant(participant.Id)
            {
                Room   = consultationRoom,
                RoomId = consultationRoom.Id
            };
            var interpreterRoomParticipant = new RoomParticipant(participant.Id)
            {
                Room   = interpreterRoom,
                RoomId = interpreterRoom.Id
            };

            consultationRoom.AddParticipant(consultationRoomParticipant);
            interpreterRoom.AddParticipant(interpreterRoomParticipant);
            participant.RoomParticipants.Add(interpreterRoomParticipant);
            participant.RoomParticipants.Add(consultationRoomParticipant);

            participant.GetParticipantRoom().Should().Be(interpreterRoom);
        }
        public async Task should_move_room_into_hearing_room()
        {
            var conferenceId    = TestConference.Id;
            var participant     = TestConference.Participants.First(x => x.UserRole == UserRole.Individual);
            var interpreterRoom = new ParticipantRoom(TestConference.Id, "Interpreter1", VirtualCourtRoomType.Civilian);

            interpreterRoom.SetProtectedProperty(nameof(interpreterRoom.Id), 999);
            var roomParticipant = new RoomParticipant(participant.Id)
            {
                Room   = interpreterRoom,
                RoomId = interpreterRoom.Id
            };

            interpreterRoom.AddParticipant(roomParticipant);
            participant.RoomParticipants.Add(roomParticipant);
            UpdateConferenceQueryMock();

            var request = new TransferParticipantRequest
            {
                ParticipantId = participant.Id,
                TransferType  = TransferType.Call
            };

            var result = await Controller.TransferParticipantAsync(conferenceId, request);

            result.Should().BeOfType <AcceptedResult>();

            VideoPlatformServiceMock.Verify(
                x => x.TransferParticipantAsync(conferenceId, interpreterRoom.Id.ToString(),
                                                RoomType.WaitingRoom.ToString(), RoomType.HearingRoom.ToString()), Times.Once);
        }
        public async Task should_return_room_with_linked_participant()
        {
            var participant          = _conference.Participants[0];
            var participantB         = _conference.Participants[1];
            var emptyInterpreterRoom = new ParticipantRoom(_conference.Id, "Interpreter2", VirtualCourtRoomType.Civilian);

            emptyInterpreterRoom.SetProtectedProperty(nameof(emptyInterpreterRoom.Id), 2);
            var interpreterRoom = new ParticipantRoom(_conference.Id, "Interpreter3", VirtualCourtRoomType.Civilian);

            interpreterRoom.SetProtectedProperty(nameof(emptyInterpreterRoom.Id), 3);
            interpreterRoom.AddParticipant(new RoomParticipant(participantB.Id));


            _mocker.Mock <IQueryHandler>().Setup(x =>
                                                 x.Handle <GetParticipantRoomsForConferenceQuery, List <ParticipantRoom> >(It.Is <GetParticipantRoomsForConferenceQuery>(q =>
                                                                                                                                                                         q.ConferenceId == _conference.Id)))
            .ReturnsAsync(new List <ParticipantRoom> {
                emptyInterpreterRoom, interpreterRoom
            });

            var room = await _service.GetOrCreateAnInterpreterVirtualRoom(_conference, participant);

            room.Should().NotBeNull();
            room.Should().BeEquivalentTo(interpreterRoom);
        }
        public async Task GivenIHaveACivilianInterpreterRoomWithAParticipant()
        {
            var conference      = _context.Test.Conference;
            var participant     = conference.Participants.First(x => x.UserRole == UserRole.Individual);
            var interpreterRoom = new ParticipantRoom(conference.Id, $"InterpreterRoom{DateTime.UtcNow.Ticks}",
                                                      VirtualCourtRoomType.Civilian);

            interpreterRoom.AddParticipant(new RoomParticipant(participant.Id));
            var seedRooms = await _context.TestDataManager.SeedRooms(new [] { interpreterRoom });

            _context.Test.Room = seedRooms.First();

            await using var db = new VideoApiDbContext(_context.VideoBookingsDbContextOptions);
            var dbParticipant = db.Participants.First(x => x.Id == participant.Id);

            dbParticipant.UpdateCurrentRoom(RoomType.WaitingRoom);
            await db.SaveChangesAsync();
        }
예제 #5
0
        public async Task should_use_interpreter_room_when_participant_is_in_an_interpreter_room_on_leave()
        {
            var fromRoom    = "ParticipantConsultationRoom1";
            var toRoom      = RoomType.WaitingRoom.ToString();
            var participant =
                TestConference.Participants.First(x => x.Id.Equals(_request.RequestedBy));
            var interpreterRoom = new ParticipantRoom(TestConference.Id, "Interpreter1", VirtualCourtRoomType.Civilian);

            interpreterRoom.SetProtectedProperty(nameof(interpreterRoom.Id), 999);
            var roomParticipant = new RoomParticipant(participant.Id)
            {
                Room   = interpreterRoom,
                RoomId = interpreterRoom.Id
            };

            interpreterRoom.AddParticipant(roomParticipant);
            participant.RoomParticipants.Add(roomParticipant);

            _queryHandler.Setup(x => x.Handle <GetConferenceByIdQuery, Conference>(It.IsAny <GetConferenceByIdQuery>()))
            .ReturnsAsync(TestConference);

            await _consultationService.LeaveConsultationAsync(_request.ConferenceId, participant.Id, fromRoom, toRoom);


            var request = new TransferParticipantParams
            {
                From    = fromRoom,
                To      = toRoom,
                Part_id = interpreterRoom.Id.ToString()
            };

            _kinlyApiClient.Verify(x => x.TransferParticipantAsync(It.Is <string>(
                                                                       y => y.Equals(_request.ConferenceId.ToString())), It.Is <TransferParticipantParams>(
                                                                       y => y.From.Equals(request.From) && y.To.Equals(request.To) && y.Part_id.Equals(request.Part_id))),
                                   Times.Once);
        }