Exemplo n.º 1
0
        public async Task should_update_participant_to_disconnected_from_virtual_room()
        {
            // Arrange conference with participant in consultation room
            var seededConference = await TestDataManager.SeedConference();

            _newConferenceIds.Add(seededConference.Id);
            var consultationRoom = new ConsultationRoom(seededConference.Id, $"JudgeConsultationRoom{DateTime.UtcNow.Ticks}",
                                                        VirtualCourtRoomType.JudgeJOH, false);

            var room = await TestDataManager.SeedRoom(consultationRoom);

            var newRoomId = room.Id;

            var pat1 = seededConference.Participants[0].Id;
            await TestDataManager.SeedRoomWithRoomParticipant(newRoomId, new RoomParticipant(pat1));

            // Act
            var command =
                new UpdateParticipantStatusAndRoomCommand(seededConference.Id, pat1, ParticipantState.Disconnected, null,
                                                          null);
            await _handler.Handle(command);

            // Assert
            var updatedConference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(seededConference.Id));

            var updatedParticipant = updatedConference.GetParticipants().Single(x => x.Id == pat1);

            updatedParticipant.State.Should().Be(ParticipantState.Disconnected);
            updatedParticipant.CurrentRoom.Should().BeNull();
            updatedParticipant.CurrentConsultationRoom.Should().BeNull();
        }
Exemplo n.º 2
0
        public async Task Should_update_participant_status_and_virtual_room()
        {
            var seededConference = await TestDataManager.SeedConference();

            _newConferenceIds.Add(seededConference.Id);
            var consultationRoom = new ConsultationRoom(seededConference.Id, $"JudgeConsultationRoom{DateTime.UtcNow.Ticks}",
                                                        VirtualCourtRoomType.JudgeJOH, false);
            var seededRoom = await TestDataManager.SeedRoom(consultationRoom);

            TestContext.WriteLine($"New seeded conference id: {seededConference.Id}");
            TestContext.WriteLine($"New seeded room id: {seededRoom.Id}");
            var participant = seededConference.GetParticipants().First(p => p.IsJudge());
            const ParticipantState state = ParticipantState.InConsultation;

            var beforeState = participant.GetCurrentStatus();

            var command = new UpdateParticipantStatusAndRoomCommand(seededConference.Id, participant.Id, state, null, seededRoom.Label);
            await _handler.Handle(command);

            var updatedConference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(seededConference.Id));

            var updatedParticipant = updatedConference.GetParticipants().Single(x => x.Username == participant.Username);
            var afterState         = updatedParticipant.GetCurrentStatus();

            afterState.Should().NotBe(beforeState);
            afterState.ParticipantState.Should().Be(state);
            updatedParticipant.CurrentRoom.Should().BeNull();
            updatedParticipant.CurrentConsultationRoom.Label.Should().Be(seededRoom.Label);
        }