public ConferenceLoader(IConferenceRepository conferenceRepository, ConferenceBuilder conferenceBuilder)
        {
            if (conferenceRepository == null)
            {
                throw new ArgumentNullException("conferenceRepository");
            }

            if (conferenceBuilder == null)
            {
                throw new ArgumentNullException("conferenceBuilder");
            }

            this.conferenceRepository = conferenceRepository;
            this.conferenceBuilder = conferenceBuilder;
        }
        public async Task should_set_endpoint_flag_to_true_when_endpoint_event()
        {
            var conference = new ConferenceBuilder()
                             .WithEndpoint("Display1", "*****@*****.**")
                             .WithEndpoint("Display2", "*****@*****.**").Build();

            var seededConference = await TestDataManager.SeedConference(conference);

            TestContext.WriteLine($"New seeded conference id: {seededConference.Id}");
            _newConferenceId = seededConference.Id;

            var externalEventId   = "AutomatedEventTestIdSuccessfulSave";
            var externalTimeStamp = DateTime.UtcNow.AddMinutes(-10);
            var participantId     = seededConference.GetEndpoints().First().Id;
            var reason            = "Automated";
            var eventType         = EventType.EndpointJoined;

            var command = new SaveEventCommand(_newConferenceId, externalEventId, eventType, externalTimeStamp,
                                               null, null, reason, null)
            {
                ParticipantId = participantId
            };
            await _handler.Handle(command);

            Event savedEvent;

            await using (var db = new VideoApiDbContext(VideoBookingsDbContextOptions))
            {
                savedEvent = await db.Events.FirstOrDefaultAsync(x =>
                                                                 x.ExternalEventId == externalEventId && x.ParticipantId == participantId);
            }

            savedEvent.Should().NotBeNull();
            savedEvent.ExternalEventId.Should().Be(externalEventId);
            savedEvent.EventType.Should().Be(eventType);
            savedEvent.ExternalTimestamp.Should().Be(externalTimeStamp);
            savedEvent.TransferredFrom.Should().BeNull();
            savedEvent.TransferredTo.Should().BeNull();
            savedEvent.Reason.Should().Be(reason);
            savedEvent.ParticipantId.Should().Be(participantId);
            savedEvent.EndpointFlag.Should().BeTrue();
        }
示例#3
0
        public async Task Should_anonymise_data_older_than_three_months()
        {
            conferenceList = new List <Domain.Conference>();
            var conferenceType       = typeof(Domain.Conference);
            var utcDate              = DateTime.UtcNow;
            var hearingClosed3Months = utcDate.AddMonths(-3).AddMinutes(-50);

            var conference1 = new ConferenceBuilder(true, scheduledDateTime: hearingClosed3Months)
                              .WithParticipant(UserRole.Representative, "Respondent")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Closed)
                              .Build();

            conferenceType.GetProperty("ClosedDateTime").SetValue(conference1, DateTime.UtcNow.AddMonths(-3).AddMinutes(-10));
            _conference1Id = conference1.Id;
            conferenceList.Add(conference1);
            var conference1Rep = conference1.Participants.FirstOrDefault(p => p.UserRole == UserRole.Representative);

            foreach (var c in conferenceList)
            {
                await TestDataManager.SeedConference(c);
            }
            var command = new AnonymiseConferencesCommand();
            await _handler.Handle(command);

            command.RecordsUpdated.Should().Be(3);

            var conference = await _handlerGetConferenceByIdQueryHandler.Handle(new GetConferenceByIdQuery(conference1.Id));

            conference.Should().NotBeNull();

            conference.CaseName.Should().NotBe(conference1.CaseName);
            var representative = conference.Participants.FirstOrDefault(p => p.UserRole == UserRole.Representative);

            representative.DisplayName.Should().NotBe(conference1Rep.DisplayName);
            representative.FirstName.Should().NotBe(conference1Rep.FirstName);
            representative.LastName.Should().NotBe(conference1Rep.LastName);
            representative.Username.Should().NotBe(conference1Rep.Username);
            representative.Representee.Should().NotBe(conference1Rep.Representee);
            representative.ContactEmail.Should().NotBe(conference1Rep.ContactEmail);
            representative.ContactTelephone.Should().NotBe(conference1Rep.ContactTelephone);
        }
        public void Should_not_add_existing_participant_to_hearing()
        {
            var conference = new ConferenceBuilder()
                             .WithParticipant(UserRole.Individual, "Claimant")
                             .WithParticipant(UserRole.Representative, "Claimant")
                             .WithParticipant(UserRole.Representative, "Defendant")
                             .WithParticipant(UserRole.Individual, "Defendant")
                             .Build();

            var beforeCount = conference.GetParticipants().Count;

            var participant = conference.GetParticipants().First();

            Action action = () => conference.AddParticipant(participant);

            action.Should().Throw <DomainRuleException>();
            var afterCount = conference.GetParticipants().Count;

            afterCount.Should().Be(beforeCount);
        }
示例#5
0
        public async Task GivenIHaveAConferenceOverDaysOld(int days)
        {
            var conferenceList       = new List <Conference>();
            var utcDate              = DateTime.UtcNow;
            var hearingClosed3Months = utcDate.AddDays(days);

            var conference1 = new ConferenceBuilder(true, scheduledDateTime: hearingClosed3Months)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Paused)
                              .Build();

            conferenceList.Add(conference1);
            _context.Test.Conference = conference1;

            foreach (var c in conferenceList)
            {
                _context.Test.Conferences.Add(await _context.TestDataManager.SeedConference(c));
            }
        }
        public async System.Threading.Tasks.Task Should_retrieve_all_alerts()
        {
            var conference = new ConferenceBuilder(true)
                             .WithParticipant(UserRole.Individual, "Applicant")
                             .WithParticipant(UserRole.Judge, "Judge")
                             .Build();

            var seededConference = await TestDataManager.SeedConference(conference);

            _newConferenceId = seededConference.Id;

            var alerts = InitTasks(conference);
            await TestDataManager.SeedAlerts(alerts);

            var query   = new GetTasksForConferenceQuery(_newConferenceId);
            var results = await _handler.Handle(query);

            results.Count.Should().Be(alerts.Count);
            results.Should().BeInDescendingOrder(x => x.Created);
        }
        public async Task Should_get_conference_details_by_hearing_ref_id()
        {
            var knownHearingRefId = Guid.NewGuid();
            var seededConference  = new ConferenceBuilder(true, knownHearingRefId)
                                    .WithParticipant(UserRole.Representative, "Respondent")
                                    .WithParticipant(UserRole.Judge, null)
                                    .WithConferenceStatus(ConferenceState.InSession)
                                    .WithEndpoints(new List <Endpoint>
            {
                new Endpoint("one", "44564", "1234", "Defence Sol"),
                new Endpoint("two", "867744", "5678", "Defence Sol")
            })
                                    .Build();

            _newConferenceId1 = seededConference.Id;
            await TestDataManager.SeedConference(seededConference);

            var conference = await _handler.Handle(new GetNonClosedConferenceByHearingRefIdQuery(knownHearingRefId));

            AssertConference(conference, conference);
        }
        public void should_get_all_messages_for_the_participant_for_the_conference()
        {
            var conference = new ConferenceBuilder().Build();

            var from        = "sender display name";
            var messageText = "test message";
            var to          = "receiver display name";

            var beforeCount = conference.GetInstantMessageHistoryFor(from).Count;

            conference.AddInstantMessage(from, messageText, to);

            var messages   = conference.GetInstantMessageHistoryFor(from);
            var afterCount = messages.Count;

            afterCount.Should().BeGreaterThan(beforeCount);
            var messageSaved = messages.First();

            messageSaved.From.Should().Be(from);
            messageSaved.MessageText.Should().Be(messageText);
        }
示例#9
0
        public void Should_not_fail_when_removing_non_existent_participant()
        {
            var conference = new ConferenceBuilder()
                             .WithParticipant(UserRole.Individual, "Applicant")
                             .Build();

            var beforeCount = conference.GetParticipants().Count;
            var userRole    = UserRole.Representative;
            var caseGroup   = "Applicant";
            var hearingRole = ParticipantBuilder.DetermineHearingRole(userRole, caseGroup);
            var participant = Builder <Participant> .CreateNew().WithFactory(() =>
                                                                             new Participant(Guid.NewGuid(), Name.FullName(), Name.First(), Name.Last(), Name.FullName(),
                                                                                             $"{RandomNumber.Next()}@hmcts.net", userRole, hearingRole, caseGroup, $"{RandomNumber.Next()}@hmcts.net", Phone.Number())).Build();

            Action action = () => conference.RemoveParticipant(participant);

            action.Should().Throw <DomainRuleException>();
            var afterCount = conference.GetParticipants().Count;

            afterCount.Should().Be(beforeCount);
        }
示例#10
0
        public void Should_map_all_properties()
        {
            var conference = new ConferenceBuilder()
                             .WithConferenceStatus(ConferenceState.InSession)
                             .WithConferenceStatus(ConferenceState.Paused)
                             .WithConferenceStatus(ConferenceState.Closed)
                             .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                             .WithParticipants(3)
                             .WithMessages(5)
                             .Build();

            var pexipSelfTestNode = "*****@*****.**";
            var response          = ConferenceToDetailsResponseMapper.MapConferenceToResponse(conference, pexipSelfTestNode);

            response.Should().BeEquivalentTo(conference, options => options
                                             .Excluding(x => x.HearingRefId)
                                             .Excluding(x => x.Participants)
                                             .Excluding(x => x.ConferenceStatuses)
                                             .Excluding(x => x.State)
                                             .Excluding(x => x.InstantMessageHistory)
                                             .Excluding(x => ExcludeIdFromMessage(x))
                                             .Excluding(x => x.IngestUrl)
                                             .Excluding(x => x.ActualStartTime)
                                             .Excluding(x => x.Endpoints)
                                             );

            response.StartedDateTime.Should().HaveValue().And.Be(conference.ActualStartTime);
            response.ClosedDateTime.Should().HaveValue().And.Be(conference.ClosedDateTime);
            response.CurrentStatus.Should().BeEquivalentTo(conference.GetCurrentStatus());

            var participants = conference.GetParticipants();

            response.Participants.Should().BeEquivalentTo(participants, options => options
                                                          .Excluding(x => x.ParticipantRefId)
                                                          .Excluding(x => x.TestCallResultId)
                                                          .Excluding(x => x.TestCallResult)
                                                          .Excluding(x => x.CurrentRoom)
                                                          .Excluding(x => x.State)
                                                          );
        }
示例#11
0
        public void Setup()
        {
            _mocker                   = AutoMock.GetLoose();
            _mockQueryHandler         = _mocker.Mock <IQueryHandler>();
            _mockVideoPlatformService = _mocker.Mock <IVideoPlatformService>();
            _mockAudioPlatformService = _mocker.Mock <IAudioPlatformService>();

            // set all positive
            var conference = new ConferenceBuilder().Build();

            _mockQueryHandler
            .Setup(x =>
                   x.Handle <GetConferenceByIdQuery, VideoApi.Domain.Conference>(It.IsAny <GetConferenceByIdQuery>()))
            .Returns(Task.FromResult(conference));

            _mockVideoPlatformService
            .Setup(x => x.GetTestCallScoreAsync(It.IsAny <Guid>(), It.IsAny <int>()))
            .ReturnsAsync((TestCallResult)null);

            _mockVideoPlatformService
            .Setup(x => x.GetPlatformHealthAsync())
            .ReturnsAsync(new VideoApi.Services.Kinly.HealthCheckResponse {
                Health_status = PlatformHealth.HEALTHY
            });

            var wowzaResponse = new []
            {
                new WowzaGetDiagnosticsResponse {
                    ServerVersion = "1.0.0.1"
                },
                new WowzaGetDiagnosticsResponse {
                    ServerVersion = "1.0.0.2"
                }
            };

            _mockAudioPlatformService.Setup(x => x.GetDiagnosticsAsync())
            .ReturnsAsync(wowzaResponse);

            _controller = _mocker.Create <HealthCheckController>();
        }
示例#12
0
        public async Task Should_update_conference_virtual_court()
        {
            var conferenceWithVirtualCourt = new ConferenceBuilder(true)
                                             .WithParticipant(UserRole.Individual, "Applicant")
                                             .WithMeetingRoom("https://poc.node.com", "*****@*****.**").Build();
            var seededConference = await TestDataManager.SeedConference(conferenceWithVirtualCourt);

            TestContext.WriteLine($"New seeded conference id: {seededConference.Id}");
            _newConferenceId = seededConference.Id;
            var command = BuildCommand(_newConferenceId);
            await _handler.Handle(command);

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

            var updatedRoom = updatedConference.GetMeetingRoom();

            updatedRoom.Should().NotBeNull();
            updatedRoom.AdminUri.Should().Be(command.AdminUri);
            updatedRoom.JudgeUri.Should().Be(command.JudgeUri);
            updatedRoom.ParticipantUri.Should().Be(command.ParticipantUri);
            updatedRoom.PexipNode.Should().Be(command.PexipNode);
        }
示例#13
0
        public void Should_map_all_properties()
        {
            var conference = new ConferenceBuilder()
                             .WithConferenceStatus(ConferenceState.InSession)
                             .WithConferenceStatus(ConferenceState.Paused)
                             .WithConferenceStatus(ConferenceState.Closed)
                             .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                             .WithParticipant(UserRole.Judge, "Judge")
                             .WithParticipants(3)
                             .Build();

            const string conferencePhoneNumber = "+441234567890";
            var          configuration         = Builder <KinlyConfiguration> .CreateNew()
                                                 .With(x => x.ConferencePhoneNumber = conferencePhoneNumber).Build();

            var response = ConferenceForAdminResponseMapper.MapConferenceToSummaryResponse(conference, configuration);

            response.Should().BeEquivalentTo(conference, options => options
                                             .Excluding(x => x.HearingRefId)
                                             .Excluding(x => x.Participants)
                                             .Excluding(x => x.ConferenceStatuses)
                                             .Excluding(x => x.State)
                                             .Excluding(x => x.InstantMessageHistory)
                                             .Excluding(x => x.IngestUrl)
                                             .Excluding(x => x.AudioRecordingRequired)
                                             .Excluding(x => x.Id)
                                             .Excluding(x => x.ActualStartTime)
                                             .Excluding(x => x.MeetingRoom)
                                             .Excluding(x => x.Endpoints)
                                             .Excluding(x => x.Rooms)
                                             );

            response.StartedDateTime.Should().Be(conference.ActualStartTime);
            response.Status.Should().BeEquivalentTo(conference.GetCurrentStatus());
            response.ClosedDateTime.Should().HaveValue().And.Be(conference.ClosedDateTime);
            response.TelephoneConferenceId.Should().Be(conference.MeetingRoom.TelephoneConferenceId);
            response.TelephoneConferenceNumber.Should().Be(conferencePhoneNumber);
            response.CreatedDateTime.Should().Be(conference.CreatedDateTime);
        }
示例#14
0
        public void Should_add_room_details()
        {
            var conference = new ConferenceBuilder().Build();

            conference.GetMeetingRoom().Should().BeNull();

            const string adminUri              = "https://poc.node.com/viju/#/[email protected]&output=embed";
            const string judgeUri              = "https://poc.node.com/viju/#/[email protected]&output=embed";
            const string participantUri        = "https://poc.node.com/viju/#/[email protected]&output=embed";
            const string pexipNode             = "poc.node.com";
            const string telephoneConferenceId = "12345678";

            conference.UpdateMeetingRoom(adminUri, judgeUri, participantUri, pexipNode, telephoneConferenceId);

            conference.GetMeetingRoom().Should().NotBeNull();
            var meetingRoom = conference.GetMeetingRoom();

            meetingRoom.AdminUri.Should().Be(adminUri);
            meetingRoom.JudgeUri.Should().Be(judgeUri);
            meetingRoom.ParticipantUri.Should().Be(participantUri);
            meetingRoom.PexipNode.Should().Be(pexipNode);
        }
示例#15
0
        // Equivalent to Main in Program.cs
        public void Run()
        {
            //Adds global exception handling
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;

            string inputStyle;

            do
            {
                Console.Write("Choose your input (\"Manual\" or \"File\"): ");
                inputStyle = Console.ReadLine();
            } while (inputStyle != null && inputStyle.ToLower() != "manual" && inputStyle.ToLower() != "file");

            var inputStrategy = _inputFactory.GetInputStrategy(inputStyle);

            var allTalks = inputStrategy.Read();

            var builder    = new ConferenceBuilder(allTalks, _trackService, _sessions);
            var conference = builder.BuildConference();

            Console.WriteLine(conference.Print());
        }
        public async Task GivenTheDefenceAdvocateIsInConsultationRoom()
        {
            var conference1 = new ConferenceBuilder()
                              .WithParticipant(UserRole.Individual, "Applicant")
                              .WithParticipant(UserRole.Representative, "Applicant", "*****@*****.**")
                              .WithParticipant(UserRole.Individual, "Respondent")
                              .WithParticipant(UserRole.Representative, "Respondent")
                              .WithParticipant(UserRole.Judge, null)
                              .WithEndpoint("Display1", Internet.FreeEmail(), "*****@*****.**")
                              .WithEndpoint("Display2", Internet.FreeEmail())
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .WithAudioRecordingRequired(false).Build();

            var consultationRoom = new ConsultationRoom(conference1.Id, "name", VirtualCourtRoomType.JudgeJOH, false);
            var defenseAdvocate  = conference1.Participants.Single(x => x.Username == "*****@*****.**");

            defenseAdvocate.UpdateCurrentConsultationRoom(consultationRoom);

            _context.Test.Conference = await _context.TestDataManager.SeedConference(conference1);

            _context.Test.Conferences.Add(_context.Test.Conference);
        }
        public async Task Should_remove_participant_from_conference_and_remove_links_to_other_participants()
        {
            var conference = new ConferenceBuilder(true, null, DateTime.UtcNow.AddMinutes(5))
                             .WithConferenceStatus(ConferenceState.InSession)
                             .Build();

            var participantA = new ParticipantBuilder(true).Build();
            var participantB = new ParticipantBuilder(true).Build();

            participantA.LinkedParticipants.Add(new LinkedParticipant(participantA.Id, participantB.Id, LinkedParticipantType.Interpreter));
            participantB.LinkedParticipants.Add(new LinkedParticipant(participantB.Id, participantA.Id, LinkedParticipantType.Interpreter));

            conference.AddParticipant(participantA);
            conference.AddParticipant(participantB);

            var seededConference = await TestDataManager.SeedConference(conference);

            TestContext.WriteLine($"New seeded conference id: {seededConference.Id}");
            _newConferenceId = seededConference.Id;
            var beforeCount = seededConference.GetParticipants().Count;

            var participantToRemove = seededConference.GetParticipants().First();
            var participants        = new List <Participant> {
                participantToRemove
            };
            var command = new RemoveParticipantsFromConferenceCommand(_newConferenceId, participants);
            await _handler.Handle(command);

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

            var confParticipants = updatedConference.GetParticipants();

            confParticipants.Any(x => x.Username == participantToRemove.Username).Should().BeFalse();
            confParticipants.Any(x => x.LinkedParticipants.Any()).Should().BeFalse();
            var afterCount = updatedConference.GetParticipants().Count;

            afterCount.Should().BeLessThan(beforeCount);
        }
示例#18
0
        public async Task should_not_transfer_participant_out_of_consultation_when_non_linked_participants_are_still_in_consultation()
        {
            // arrange
            var conference = new ConferenceBuilder()
                             .WithParticipant(UserRole.Judge, null)
                             .WithParticipant(UserRole.Individual, "Applicant")
                             .WithParticipant(UserRole.Representative, "Applicant")
                             .WithParticipant(UserRole.Representative, "Respondent")
                             .Build();

            var participant      = conference.Participants.First(x => !x.IsJudge() && x.GetParticipantRoom() == null);
            var consultationRoom = new ConsultationRoom(conference.Id, "ConsultationRoom2", VirtualCourtRoomType.Participant, false);

            foreach (var p in conference.Participants.Where(x => !x.IsJudge()))
            {
                consultationRoom.AddParticipant(new RoomParticipant(p.Id));
            }

            _mocker.Mock <IQueryHandler>().Setup(x => x.Handle <GetConferenceByIdQuery, Conference>(
                                                     It.Is <GetConferenceByIdQuery>(q => q.ConferenceId == conference.Id)))
            .ReturnsAsync(conference);

            _mocker.Mock <IQueryHandler>().Setup(x => x.Handle <GetConsultationRoomByIdQuery, ConsultationRoom>(It.IsAny <GetConsultationRoomByIdQuery>())).ReturnsAsync(consultationRoom);

            // act
            await _sut.LeaveConsultationAsync(conference.Id, participant.Id, consultationRoom.Label,
                                              RoomType.WaitingRoom.ToString());

            // assert
            _mocker.Mock <IKinlyApiClient>().Verify(x =>
                                                    x.TransferParticipantAsync(conference.Id.ToString(),
                                                                               It.Is <TransferParticipantParams>(r =>
                                                                                                                 r.From == consultationRoom.Label &&
                                                                                                                 r.To == RoomType.WaitingRoom.ToString() &&
                                                                                                                 r.Part_id == participant.Id.ToString())
                                                                               )
                                                    , Times.Once);
        }
示例#19
0
        public async Task <Conference> SeedConference()
        {
            var conference = new ConferenceBuilder(true)
                             .WithParticipant(UserRole.Individual, "Claimant")
                             .WithParticipant(UserRole.Representative, "Claimant")
                             .WithParticipant(UserRole.Individual, "Defendant")
                             .WithParticipant(UserRole.Representative, "Defendant")
                             .WithParticipant(UserRole.Judge, null)
                             .WithConferenceStatus(ConferenceState.InSession)
                             .WithMeetingRoom(_services.PexipNode, _services.ConferenceUsername)
                             .WithAudioRecordingRequired(false)
                             .Build();
            var conferenceType = typeof(Conference);

            conferenceType.GetProperty("ActualStartTime")?.SetValue(conference, conference.ScheduledDateTime.AddMinutes(1));

            foreach (var individual in conference.GetParticipants().Where(x => x.UserRole == UserRole.Individual))
            {
                individual.UpdateTestCallResult(true, TestScore.Okay);
            }

            return(await SeedConference(conference));
        }
        public void Should_get_all_messages_from_hearing()
        {
            var conference  = new ConferenceBuilder().Build();
            var beforeCount = conference.GetInstantMessageHistory().Count;

            var from        = "Display name";
            var messageText = "test message";
            var to          = "Receiver Display name";

            conference.AddInstantMessage(from, messageText, to);

            //Act
            var messages = conference.GetInstantMessageHistory();

            //Assert
            var afterCount = messages.Count;

            afterCount.Should().BeGreaterThan(beforeCount);
            var messageSaved = messages.First();

            messageSaved.From.Should().Be(from);
            messageSaved.MessageText.Should().Be(messageText);
        }
示例#21
0
        public async Task GivenIHaveAConferenceClosedOverMonthsAgo(int p0)
        {
            var conferenceList       = new List <Conference>();
            var conferenceType       = typeof(Conference);
            var utcDate              = DateTime.UtcNow;
            var hearingClosed3Months = utcDate.AddMonths(-3).AddMinutes(-50);

            var conference1 = new ConferenceBuilder(true, scheduledDateTime: hearingClosed3Months)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Closed)
                              .Build();

            conferenceType.GetProperty("ClosedDateTime")
            ?.SetValue(conference1, DateTime.UtcNow.AddMonths(-3).AddMinutes(-10));
            conferenceList.Add(conference1);
            _context.Test.Conference = conference1;

            foreach (var c in conferenceList)
            {
                _context.Test.Conferences.Add(await _context.TestDataManager.SeedConference(c));
            }
        }
示例#22
0
        public async Task should_set_start_time_when_status_moves_from_not_started_to_in_session()
        {
            var conference = new ConferenceBuilder(true)
                             .Build();
            var seededConference = await TestDataManager.SeedConference(conference);

            TestContext.WriteLine($"New seeded conference id: {seededConference.Id}");
            _newConferenceId = seededConference.Id;
            const ConferenceState state = ConferenceState.InSession;

            var beforeState = seededConference.GetCurrentStatus();

            var command = new UpdateConferenceStatusCommand(_newConferenceId, state);
            await _handler.Handle(command);

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

            var afterState = updatedConference.GetCurrentStatus();

            afterState.Should().NotBe(beforeState);
            afterState.Should().Be(state);
            updatedConference.ActualStartTime.Should().HaveValue();
        }
示例#23
0
        public void should_map_all_properties()
        {
            var conference = new ConferenceBuilder()
                             .WithConferenceStatus(ConferenceState.InSession)
                             .WithConferenceStatus(ConferenceState.Paused)
                             .WithConferenceStatus(ConferenceState.Closed)
                             .WithParticipant(UserRole.Judge, "Judge")
                             .WithParticipants(3)
                             .WithEndpoint("3000", "sip address")
                             .Build();

            var response = ConferenceForJudgeResponseMapper.MapConferenceSummaryToModel(conference);

            response.Id.Should().Be(conference.Id);
            response.ScheduledDateTime.Should().Be(conference.ScheduledDateTime);
            response.ScheduledDuration.Should().Be(conference.ScheduledDuration);
            response.CaseType.Should().Be(conference.CaseType);
            response.CaseName.Should().Be(conference.CaseName);
            response.CaseNumber.Should().Be(conference.CaseNumber);
            response.Status.ToString().Should().Be(conference.State.ToString());
            response.Participants.Count.Should().Be(conference.Participants.Count);
            response.NumberOfEndpoints.Should().Be(conference.Endpoints.Count);
        }
示例#24
0
        public async Task Should_remove_existing_endpoint()
        {
            var conference1 = new ConferenceBuilder()
                              .WithEndpoint("Display1", "*****@*****.**").Build();
            var seededConference = await TestDataManager.SeedConference(conference1);

            var sipAddress = conference1.Endpoints.First().SipAddress;

            TestContext.WriteLine($"New seeded conference id: {seededConference.Id}");
            _newConferenceId = seededConference.Id;

            var command = new RemoveEndpointCommand(_newConferenceId, sipAddress);
            await _handler.Handle(command);

            Conference updatedConference;

            await using (var db = new VideoApiDbContext(VideoBookingsDbContextOptions))
            {
                updatedConference = await db.Conferences.Include(x => x.Endpoints)
                                    .AsNoTracking().SingleOrDefaultAsync(x => x.Id == _newConferenceId);
            }

            updatedConference.GetEndpoints().Should().BeEmpty();
        }
        public async Task Should_not_anonymise_data_older_than_two_months_and_less_than_three_months()
        {
            conferenceList = new List <Domain.Conference>();
            var conferenceType      = typeof(Domain.Conference);
            var utcDate             = DateTime.UtcNow;
            var hearingclosed1Month = utcDate.AddMonths(-1).AddMinutes(-50);

            var conference2 = new ConferenceBuilder(true, scheduledDateTime: hearingclosed1Month)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Closed)
                              .Build();

            conferenceType.GetProperty("ClosedDateTime").SetValue(conference2, DateTime.UtcNow.AddMonths(-1).AddMinutes(-10));
            _conference2Id = conference2.Id;
            conferenceList.Add(conference2);
            var conference2Rep = conference2.Participants.FirstOrDefault(p => p.UserRole == UserRole.Representative);

            foreach (var c in conferenceList)
            {
                await TestDataManager.SeedConference(c);
            }
            var command = new AnonymiseConferencesCommand();
            await _handler.Handle(command);

            command.RecordsUpdated.Should().Be(-1);

            var conference = await _handlerGetConferenceByIdQueryHandler.Handle(new GetConferenceByIdQuery(conference2.Id));

            conference.Should().NotBeNull();

            conference.CaseName.Should().Be(conference2.CaseName);
            var representative = conference.Participants.FirstOrDefault(p => p.UserRole == UserRole.Representative);

            representative.DisplayName.Should().Be(conference2Rep.DisplayName);
        }
        public async Task Should_get_list_of_judges_excluding_anonymised_and_automation_test_users()
        {
            var newConference = new ConferenceBuilder(true)
                                .WithParticipant(UserRole.Judge, "Judge", "*****@*****.**", "JudgeManchester", null, ParticipantState.None)
                                .WithParticipant(UserRole.Representative, "Claimant", "*****@*****.**", "Claimaint", null, ParticipantState.None)
                                .WithParticipant(UserRole.Individual, "Claimant", "*****@*****.**", "Claimaint", null, ParticipantState.None)
                                .Build();

            _conferenceIds.Add(newConference.Id);
            await TestDataManager.SeedConference(newConference);

            // anonymised data
            newConference = new ConferenceBuilder(true)
                            .WithParticipant(UserRole.Judge, "Judge", "*****@*****.**", "JudgeLondon", null, ParticipantState.None)
                            .WithParticipant(UserRole.Representative, "Claimant", "*****@*****.**", "Claimaint", null, ParticipantState.None)
                            .WithParticipant(UserRole.Individual, "Claimant", "*****@*****.**", "Claimaint", null, ParticipantState.None)
                            .Build();
            _conferenceIds.Add(newConference.Id);
            await TestDataManager.SeedConference(newConference);

            var judgelist = await _handler.Handle(new GetDistinctJudgeListByFirstNameQuery());

            judgelist.Should().NotBeEmpty();
        }
 private void When_I_Build_The_Domain_Model()
 {
     var conferenceBuilder = new ConferenceBuilder(_calendarItemRepository, new CalendarEntryBuilder());
     _domainModel = conferenceBuilder.Build(_source);
 }
        public async Task Should_get_conference_with_meeting_room_for_username()
        {
            const string username    = "******";
            var          conference1 = new ConferenceBuilder(true)
                                       .WithParticipant(UserRole.Representative, "Defendant", username)
                                       .WithParticipant(UserRole.Judge, null)
                                       .WithConferenceStatus(ConferenceState.Closed)
                                       .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                                       .Build();

            _newConferenceId1 = conference1.Id;

            var conference2 = new ConferenceBuilder(true)
                              .WithParticipant(UserRole.Representative, "Defendant", username)
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId2 = conference2.Id;

            var conference3 = new ConferenceBuilder(true)
                              .WithParticipant(UserRole.Representative, "Defendant", username)
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Paused)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId3 = conference3.Id;

            var conference4 = new ConferenceBuilder(true)
                              .WithParticipant(UserRole.Representative, "Defendant", username)
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Suspended)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId4 = conference4.Id;

            var conference5 = new ConferenceBuilder(true, null, DateTime.UtcNow.AddDays(-1))
                              .WithParticipant(UserRole.Representative, "Defendant", username)
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Closed)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId5 = conference5.Id;

            var conference6 = new ConferenceBuilder(true)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId6 = conference6.Id;

            var conference7 = new ConferenceBuilder(true)
                              .WithParticipant(UserRole.Representative, "Defendant", username)
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId7 = conference7.Id;

            var conference8 = new ConferenceBuilder(true)
                              .WithParticipant(UserRole.Representative, "Defendant", username)
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .Build();

            _newConferenceId8 = conference8.Id;

            await TestDataManager.SeedConference(conference1);

            await TestDataManager.SeedConference(conference2);

            await TestDataManager.SeedConference(conference3);

            await TestDataManager.SeedConference(conference4);

            await TestDataManager.SeedConference(conference5);

            await TestDataManager.SeedConference(conference6);

            await TestDataManager.SeedConference(conference7);

            await TestDataManager.SeedConference(conference8);

            var expectedConferences = new List <Conference> {
                conference1, conference2, conference3, conference4, conference7
            };
            var conferences = await _handler.Handle(new GetConferencesForTodayByIndividualQuery(username));

            conferences.Should().NotBeEmpty();
            conferences.Select(x => x.Id).Should().BeEquivalentTo(expectedConferences.Select(x => x.Id));
        }
示例#29
0
        public async Task Should_get_conference_with_meeting_room_for_today()
        {
            var today       = DateTime.Today.AddHours(10);
            var tomorrow    = DateTime.Today.AddDays(1).AddHours(10);
            var yesterday   = DateTime.Today.AddDays(-1).AddHours(10);
            var conference1 = new ConferenceBuilder(true, scheduledDateTime: yesterday)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Closed)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId1 = conference1.Id;

            var conference2 = new ConferenceBuilder(true, scheduledDateTime: today)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId2 = conference2.Id;

            var conference3 = new ConferenceBuilder(true, scheduledDateTime: tomorrow)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Paused)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId3 = conference3.Id;

            var conference4 = new ConferenceBuilder(true, scheduledDateTime: yesterday)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Suspended)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId4 = conference4.Id;

            var conference5 = new ConferenceBuilder(true, scheduledDateTime: tomorrow)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Suspended)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId5 = conference5.Id;

            var conference6 = new ConferenceBuilder(true, scheduledDateTime: today)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId6 = conference6.Id;

            var conference7 = new ConferenceBuilder(true, scheduledDateTime: today)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId7 = conference7.Id;


            var conference8 = new ConferenceBuilder(true, scheduledDateTime: today)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .Build();

            _newConferenceId8 = conference8.Id;


            await TestDataManager.SeedConference(conference1);

            await TestDataManager.SeedConference(conference2);

            await TestDataManager.SeedConference(conference3);

            await TestDataManager.SeedConference(conference4);

            await TestDataManager.SeedConference(conference5);

            await TestDataManager.SeedConference(conference6);

            await TestDataManager.SeedConference(conference7);

            await TestDataManager.SeedConference(conference8);

            var conferences = await _handler.Handle(new GetConferencesTodayForAdminQuery());

            conferences.Should().NotBeEmpty();
            foreach (var conference in conferences)
            {
                conference.ScheduledDateTime.DayOfYear.Should().Be(DateTime.UtcNow.DayOfYear);
                conference.MeetingRoom.IsSet().Should().BeTrue();
            }

            TestContext.WriteLine("Cleaning conferences for GetConferencesTodayForAdminQueryHandler");
            await TestDataManager.RemoveConference(_newConferenceId1);

            await TestDataManager.RemoveConference(_newConferenceId2);

            await TestDataManager.RemoveConference(_newConferenceId3);

            await TestDataManager.RemoveConference(_newConferenceId4);

            await TestDataManager.RemoveConference(_newConferenceId5);

            await TestDataManager.RemoveConference(_newConferenceId6);

            await TestDataManager.RemoveConference(_newConferenceId7);

            await TestDataManager.RemoveConference(_newConferenceId8);
        }
示例#30
0
        public async Task should_get_conferences_for_today_filtered_by_judge_firstname()
        {
            var venue1 = @"Manchester";
            var venue2 = @"Birmingham";
            var venue3 = @"Luton";

            var participants1 = new List <Participant>
            {
                new Participant(Guid.NewGuid(), "", "firstJudge", "James", "Judge James", "*****@*****.**",
                                UserRole.Judge, ParticipantBuilder.DetermineHearingRole(UserRole.Individual, "Children Act"),
                                "Children Act", Internet.Email(), Phone.Number()),
                new Participant(Guid.NewGuid(), "", "firstname", "lastname", "firstname lastname",
                                "*****@*****.**", UserRole.Individual,
                                ParticipantBuilder.DetermineHearingRole(UserRole.Individual, "Children Act"), "Children Act",
                                Internet.Email(), Phone.Number())
            };
            var participants2 = new List <Participant>
            {
                new Participant(Guid.NewGuid(), "", "secondJudge", "James II", "SecondJudge James II",
                                "*****@*****.**", UserRole.Judge,
                                ParticipantBuilder.DetermineHearingRole(UserRole.Judge, "Children Act"), "Children Act",
                                Internet.Email(), Phone.Number()),
                new Participant(Guid.NewGuid(), "", "individualFirst", "lastname", "individualFirst lastname",
                                "*****@*****.**", UserRole.Individual,
                                ParticipantBuilder.DetermineHearingRole(UserRole.Individual, "Children Act"), "Children Act",
                                Internet.Email(),
                                Phone.Number()),
            };
            var participants3 = new List <Participant>
            {
                new Participant(Guid.NewGuid(), "", "firstJudge", "James", "firstJudge James",
                                "*****@*****.**", UserRole.Judge,
                                ParticipantBuilder.DetermineHearingRole(UserRole.Judge, "Children Act"), "Children Act",
                                Internet.Email(), Phone.Number()),
                new Participant(Guid.NewGuid(), "", "representativeFirst", "lastname", "representativeFirst lastname",
                                "*****@*****.**", UserRole.Representative,
                                ParticipantBuilder.DetermineHearingRole(UserRole.Representative, "Children Act"), "Children Act",
                                Internet.Email(),
                                Phone.Number()),
            };
            var participants4 = new List <Participant>
            {
                new Participant(Guid.NewGuid(), "", "thirdJudge", "James", "thirdJudge James",
                                "*****@*****.**", UserRole.Judge, ParticipantBuilder.DetermineHearingRole(UserRole.Judge, "Children Act"), "Children Act", Internet.Email(), Phone.Number()),
                new Participant(Guid.NewGuid(), "", "representativeFirst", "lastname", "representativeFirst lastname",
                                "*****@*****.**", UserRole.Representative, ParticipantBuilder.DetermineHearingRole(UserRole.Representative, "Children Act"), "Children Act", Internet.Email(),
                                Phone.Number()),
            };
            var participants5 = new List <Participant>
            {
                new Participant(Guid.NewGuid(), "", "thirdJudge", "James", "thirdJudge James",
                                "*****@*****.**", UserRole.Judge, ParticipantBuilder.DetermineHearingRole(UserRole.Judge, "Children Act"), "Children Act", Internet.Email(), Phone.Number()),
                new Participant(Guid.NewGuid(), "", "representativeSecond", "lastname", "representativeSecond lastname",
                                "*****@*****.**", UserRole.Representative, ParticipantBuilder.DetermineHearingRole(UserRole.Representative, "Children Act"), "Children Act",
                                Internet.Email(), Phone.Number()),
            };
            var participants6 = new List <Participant>
            {
                new Participant(Guid.NewGuid(), "", "secondJudge", "James II", "SecondJudge James II",
                                "*****@*****.**", UserRole.Judge,
                                ParticipantBuilder.DetermineHearingRole(UserRole.Judge, "Children Act"), "Children Act",
                                Internet.Email(), Phone.Number()),
                new Participant(Guid.NewGuid(), "", "representativeThird", "lastname", "representativeThird lastname",
                                "*****@*****.**", UserRole.Representative,
                                ParticipantBuilder.DetermineHearingRole(UserRole.Representative, "Children Act"), "Children Act",
                                Internet.Email(),
                                Phone.Number()),
            };

            var conference1 = new ConferenceBuilder(true, venueName: venue1)
                              .WithParticipants(participants1)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId1 = conference1.Id;

            var conference2 = new ConferenceBuilder(true, venueName: venue1)
                              .WithParticipants(participants2)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId2 = conference2.Id;

            var conference3 = new ConferenceBuilder(true, venueName: venue2)
                              .WithParticipants(participants3)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId3 = conference3.Id;

            var conference4 = new ConferenceBuilder(true, venueName: venue2)
                              .WithParticipants(participants4)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId4 = conference4.Id;

            var conference5 = new ConferenceBuilder(true, venueName: venue3)
                              .WithParticipants(participants5)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId5 = conference5.Id;

            var conference6 = new ConferenceBuilder(true, venueName: venue3)
                              .WithParticipants(participants6)
                              .WithMeetingRoom("https://poc.node.com", "*****@*****.**")
                              .Build();

            _newConferenceId6 = conference6.Id;

            await TestDataManager.SeedConference(conference1);

            await TestDataManager.SeedConference(conference2);

            await TestDataManager.SeedConference(conference3);

            await TestDataManager.SeedConference(conference4);

            await TestDataManager.SeedConference(conference5);

            await TestDataManager.SeedConference(conference6);

            var result = await _handler.Handle(new GetConferencesTodayForAdminQuery
            {
                UserNames = new List <string> {
                    participants1[0].FirstName, participants4[0].FirstName
                }
            });

            result.Should().NotBeEmpty();
            result.Count.Should().Be(4);
            result.Should().BeInAscendingOrder(c => c.ScheduledDateTime);

            result[0].Participants.FirstOrDefault(x => x.UserRole == UserRole.Judge)?.FirstName.Should()
            .Be(participants1[0].FirstName);
            result[1].Participants.FirstOrDefault(x => x.UserRole == UserRole.Judge)?.FirstName.Should()
            .Be(participants1[0].FirstName);
            result[2].Participants.FirstOrDefault(x => x.UserRole == UserRole.Judge)?.FirstName.Should()
            .Be(participants4[0].FirstName);
            result[3].Participants.FirstOrDefault(x => x.UserRole == UserRole.Judge)?.FirstName.Should()
            .Be(participants4[0].FirstName);

            TestContext.WriteLine("Cleaning conferences for GetConferencesTodayForAdminQueryHandler");
            await TestDataManager.RemoveConference(_newConferenceId1);

            await TestDataManager.RemoveConference(_newConferenceId2);

            await TestDataManager.RemoveConference(_newConferenceId3);

            await TestDataManager.RemoveConference(_newConferenceId4);

            await TestDataManager.RemoveConference(_newConferenceId5);

            await TestDataManager.RemoveConference(_newConferenceId6);
        }
示例#31
0
        private void When_I_Build_The_Domain_Model()
        {
            var conferenceBuilder = new ConferenceBuilder(_calendarItemRepository, new CalendarEntryBuilder());

            _domainModel = conferenceBuilder.Build(_source);
        }
        public void Should_not_be_closed_by_default()
        {
            var conference = new ConferenceBuilder().Build();

            conference.IsClosed().Should().BeFalse();
        }