Example #1
0
        public ConferenceBuilder WithParticipant(UserRole userRole, string caseTypeGroup,
                                                 string username = null, string firstName = null, RoomType?roomType = null,
                                                 ParticipantState participantState = ParticipantState.None)
        {
            if (string.IsNullOrWhiteSpace(username))
            {
                username = $"Video_Api_Integration_Test_{RandomNumber.Next()}@hmcts.net";
            }

            if (string.IsNullOrWhiteSpace(firstName))
            {
                firstName = Name.First();
            }

            var hearingRole = ParticipantBuilder.DetermineHearingRole(userRole, caseTypeGroup);
            var participant = new Builder(_builderSettings).CreateNew <Participant>().WithFactory(() =>
                                                                                                  new Participant(Guid.NewGuid(), Name.FullName(), firstName, Name.Last(), Name.FullName(), username,
                                                                                                                  userRole, hearingRole, caseTypeGroup, $"Video_Api_Integration_Test_{RandomNumber.Next()}@hmcts.net", Phone.Number()))
                              .And(x => x.TestCallResultId          = null)
                              .And(x => x.CurrentConsultationRoomId = null)
                              .Build();

            if (userRole == UserRole.Representative)
            {
                participant.Representee = "Person";
            }

            if (roomType.HasValue)
            {
                participant.UpdateCurrentRoom(roomType);
                if (roomType == RoomType.ConsultationRoom)
                {
                    participant.CurrentConsultationRoomId = 1;
                    participant.UpdateCurrentConsultationRoom(new ConsultationRoom(Guid.Empty, "Room1", VirtualCourtRoomType.Participant, false));
                }
            }

            participant.UpdateParticipantStatus(participantState == ParticipantState.None
                ? ParticipantState.Available
                : participantState);
            _conference.AddParticipant(participant);

            return(this);
        }
Example #2
0
        public ConferenceBuilder WithParticipant(UserRole userRole, string caseTypeGroup,
                                                 string username = null, string firstName = null, RoomType?roomType = null,
                                                 ParticipantState participantState = ParticipantState.None)
        {
            if (string.IsNullOrWhiteSpace(username))
            {
                username = $"Video_Api_Integration_Test_{Internet.Email()}";
            }

            if (string.IsNullOrWhiteSpace(firstName))
            {
                firstName = Name.First();
            }

            var hearingRole = ParticipantBuilder.DetermineHearingRole(userRole, caseTypeGroup);
            var participant = new Builder(_builderSettings).CreateNew <Participant>().WithFactory(() =>
                                                                                                  new Participant(Guid.NewGuid(), Name.FullName(), firstName, Name.Last(), Name.FullName(), username,
                                                                                                                  userRole, hearingRole, caseTypeGroup, $"Video_Api_Integration_Test_{Internet.Email()}", Phone.Number())).Build();

            if (userRole == UserRole.Representative)
            {
                participant.Representee = "Person";
            }

            if (roomType.HasValue)
            {
                participant.UpdateCurrentRoom(roomType);
            }

            participant.UpdateParticipantStatus(participantState == ParticipantState.None
                ? ParticipantState.Available
                : participantState);
            _conference.AddParticipant(participant);

            return(this);
        }