private static List <Task> InitTasks(Conference conference)
        {
            const string body      = "Automated Test Complete Task";
            const string updatedBy = "*****@*****.**";

            var judge      = conference.GetParticipants().First(x => x.UserRole == UserRole.Judge);
            var individual = conference.GetParticipants().First(x => x.UserRole == UserRole.Individual);

            var judgeTaskDone = new Task(conference.Id, judge.Id, body, TaskType.Judge);

            judgeTaskDone.CompleteTask(updatedBy);
            var participantTaskDone = new Task(conference.Id, individual.Id, body, TaskType.Participant);

            participantTaskDone.CompleteTask(updatedBy);
            var conferenceTaskDone = new Task(conference.Id, conference.Id, body, TaskType.Hearing);

            conferenceTaskDone.CompleteTask(updatedBy);

            var judgeTaskTodo       = new Task(conference.Id, judge.Id, body, TaskType.Judge);
            var participantTaskTodo = new Task(conference.Id, individual.Id, body, TaskType.Participant);
            var conferenceTaskToDo  = new Task(conference.Id, conference.Id, body, TaskType.Hearing);

            return(new List <Task>
            {
                judgeTaskTodo,
                participantTaskTodo,
                conferenceTaskToDo,
                judgeTaskDone,
                participantTaskDone,
                conferenceTaskDone
            });
        }
Exemple #2
0
        public async Task GivenIHaveAManyOpenConferencesWithMessages()
        {
            var conferenceList = new List <Conference>();
            var conferenceType = typeof(Conference);
            var utcDate        = DateTime.UtcNow;
            var oldHearing     = utcDate.AddMinutes(-180);

            var conference3 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Paused)
                              .WithMessages(3)
                              .Build();

            conferenceList.Add(conference3);

            var conference4 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .WithMessages(3)
                              .Build();

            conferenceType.GetProperty("ClosedDateTime")?.SetValue(conference4, DateTime.UtcNow.AddMinutes(-30));
            conferenceList.Add(conference4);

            var conference5 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .WithMessages(3)
                              .Build();

            conferenceList.Add(conference5);

            var conference6 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Suspended)
                              .Build();

            conferenceList.Add(conference6);

            foreach (var c in conferenceList)
            {
                _context.Test.Conferences.Add(await _context.TestDataManager.SeedConference(c));
            }

            var alert3 = new Alert(conference3.Id, conference3.Id, "Disconnected", TaskType.Participant);
            var alert4 = new Alert(conference4.Id, conference4.Id, "Disconnected", TaskType.Participant);
            var alert5 = new Alert(conference5.Id, conference5.Id, "Disconnected", TaskType.Participant);
            var alert6 = new Alert(conference6.Id, conference6.Id, "Disconnected", TaskType.Participant);

            _context.Test.Alerts = await _context.TestDataManager.SeedAlerts(new List <Alert>
            {
                alert3, alert4, alert5, alert6
            });
        }
Exemple #3
0
        public async Task GivenIHaveAManyVeryOldClosedConferencesWithMessages()
        {
            var conferenceList = new List <Conference>();
            var conferenceType = typeof(Conference);
            var utcDate        = DateTime.UtcNow;
            var oldHearing     = utcDate.AddMonths(-4);

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

            conferenceType.GetProperty("ClosedDateTime")?.SetValue(conference1, DateTime.UtcNow.AddMonths(-3));
            conferenceList.Add(conference1);

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

            conferenceType.GetProperty("ClosedDateTime")?.SetValue(conference1, DateTime.UtcNow.AddMonths(-2));
            conferenceList.Add(conference2);

            var conference3 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Closed)
                              .WithMessages(3)
                              .Build();

            conferenceType.GetProperty("ClosedDateTime")?.SetValue(conference3, DateTime.UtcNow.AddMonths(-1));
            conferenceList.Add(conference3);

            foreach (var c in conferenceList)
            {
                _context.Test.Conferences.Add(await _context.TestDataManager.SeedConference(c));
            }

            var alert1 = new Alert(conference1.Id, conference1.Id, "Disconnected", TaskType.Participant);
            var alert2 = new Alert(conference2.Id, conference2.Id, "Disconnected", TaskType.Participant);
            var alert3 = new Alert(conference3.Id, conference3.Id, "Disconnected", TaskType.Participant);

            _context.Test.Alerts = await _context.TestDataManager.SeedAlerts(new List <Alert>
            {
                alert1, alert2, alert3
            });
        }
Exemple #4
0
        public async Task GivenIHaveManyConferences()
        {
            var conferenceType = typeof(Conference);
            var today          = DateTime.Today.ToUniversalTime().AddMinutes(1);
            var tomorrow       = DateTime.Today.ToUniversalTime().AddDays(1).AddMinutes(1);
            var yesterday      = DateTime.Today.ToUniversalTime().AddDays(-1).AddMinutes(1);

            var venue1 = "Manchester";
            var venue2 = "Birmingham";

            var pexipNode = "int-test.pexip.com";
            var username  = "******";

            var yesterdayClosedConference = new ConferenceBuilder(true, scheduledDateTime: yesterday, venueName: venue1)
                                            .WithParticipant(UserRole.Representative, "Defendant")
                                            .WithParticipant(UserRole.Judge, null)
                                            .WithConferenceStatus(ConferenceState.Closed)
                                            .WithMeetingRoom(pexipNode, username)
                                            .Build();

            conferenceType.GetProperty("ActualStartTime")?.SetValue(yesterdayClosedConference, yesterday.AddMinutes(5));
            conferenceType.GetProperty("ClosedDateTime")?.SetValue(yesterdayClosedConference, yesterday.AddMinutes(35));

            var todayConference1 = new ConferenceBuilder(true, scheduledDateTime: today, venueName: venue1)
                                   .WithParticipant(UserRole.Representative, "Defendant")
                                   .WithParticipant(UserRole.Judge, null)
                                   .WithConferenceStatus(ConferenceState.InSession)
                                   .WithMeetingRoom(pexipNode, username)
                                   .Build();

            conferenceType.GetProperty("ActualStartTime")?.SetValue(todayConference1, today.AddMinutes(5));

            var tomorrowConference1 = new ConferenceBuilder(true, scheduledDateTime: tomorrow, venueName: venue1)
                                      .WithParticipant(UserRole.Representative, "Defendant")
                                      .WithParticipant(UserRole.Judge, null)
                                      .WithConferenceStatus(ConferenceState.Paused)
                                      .WithMeetingRoom(pexipNode, username)
                                      .Build();

            conferenceType.GetProperty("ActualStartTime")?.SetValue(tomorrowConference1, tomorrow.AddMinutes(5));
            conferenceType.GetProperty("ClosedDateTime")?.SetValue(tomorrowConference1, yesterday.AddMinutes(35));

            var todayConference2 = new ConferenceBuilder(true, scheduledDateTime: today, venueName: venue2)
                                   .WithParticipant(UserRole.Representative, "Defendant")
                                   .WithParticipant(UserRole.Judge, null)
                                   .WithConferenceStatus(ConferenceState.Suspended)
                                   .WithMeetingRoom(pexipNode, username)
                                   .Build();

            conferenceType.GetProperty("ActualStartTime")?.SetValue(todayConference2, today.AddMinutes(5));

            var tomorrowConference2 = new ConferenceBuilder(true, scheduledDateTime: tomorrow, venueName: venue2)
                                      .WithParticipant(UserRole.Representative, "Defendant")
                                      .WithParticipant(UserRole.Judge, null)
                                      .WithConferenceStatus(ConferenceState.Suspended)
                                      .WithMeetingRoom(pexipNode, username)
                                      .Build();

            conferenceType.GetProperty("ActualStartTime")?.SetValue(tomorrowConference2, tomorrow.AddMinutes(5));

            var yesterdayConference2 = new ConferenceBuilder(true, scheduledDateTime: yesterday, venueName: venue2)
                                       .WithParticipant(UserRole.Representative, "Defendant")
                                       .WithParticipant(UserRole.Judge, null)
                                       .WithMeetingRoom(pexipNode, username)
                                       .Build();

            _context.Test.ClosedConferences.Add(
                await _context.TestDataManager.SeedConference(yesterdayClosedConference));
            _context.Test.YesterdayClosedConference = _context.Test.ClosedConferences.First();
            _context.Test.TodaysConferences.Add(await _context.TestDataManager.SeedConference(todayConference1));
            await _context.TestDataManager.SeedConference(tomorrowConference1);

            _context.Test.TodaysConferences.Add(await _context.TestDataManager.SeedConference(todayConference2));
            await _context.TestDataManager.SeedConference(tomorrowConference2);

            _context.Test.ClosedConferences.Add(await _context.TestDataManager.SeedConference(yesterdayConference2));

            var alert1 = new Alert(yesterdayClosedConference.Id, yesterdayClosedConference.Id, "Disconnected",
                                   TaskType.Participant);
            var alert2 = new Alert(todayConference1.Id, todayConference1.Id, "Disconnected", TaskType.Participant);
            var alert3 = new Alert(tomorrowConference1.Id, tomorrowConference1.Id, "Disconnected",
                                   TaskType.Participant);
            var alert4 = new Alert(todayConference2.Id, todayConference2.Id, "Disconnected", TaskType.Participant);
            var alert5 = new Alert(todayConference2.Id, todayConference2.Id, "Disconnected", TaskType.Participant);
            var alert6 = new Alert(yesterdayConference2.Id, yesterdayConference2.Id, "Disconnected",
                                   TaskType.Participant);

            _context.Test.Conferences.Add(yesterdayClosedConference);
            _context.Test.Conferences.Add(todayConference1);
            _context.Test.Conferences.Add(tomorrowConference1);
            _context.Test.Conferences.Add(todayConference2);
            _context.Test.Conferences.Add(tomorrowConference2);
            _context.Test.Conferences.Add(yesterdayConference2);

            _context.Test.Alerts = await _context.TestDataManager.SeedAlerts(new List <Alert>
            {
                alert1, alert2, alert3, alert4, alert5, alert6
            });
        }
Exemple #5
0
        public async Task GivenIHaveSeveralClosedConferencesWithMessages()
        {
            var conferenceList = new List <Conference>();
            var conferenceType = typeof(Conference);
            var utcDate        = DateTime.UtcNow;
            var currentHearing = utcDate.AddMinutes(-40);
            var oldHearing     = utcDate.AddMinutes(-180);

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

            conferenceType.GetProperty("ClosedDateTime")?.SetValue(conference1, DateTime.UtcNow.AddMinutes(-20));
            conferenceList.Add(conference1);

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

            conferenceType.GetProperty("ClosedDateTime")?.SetValue(conference1, DateTime.UtcNow.AddMinutes(-40));
            conferenceList.Add(conference2);

            var conference3 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Paused)
                              .WithMessages(3)
                              .Build();

            conferenceList.Add(conference3);

            var conference4 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.Closed)
                              .WithMessages(3)
                              .Build();

            conferenceType.GetProperty("ClosedDateTime")?.SetValue(conference4, DateTime.UtcNow.AddMinutes(-20));
            conferenceList.Add(conference4);

            var conference5 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .WithConferenceStatus(ConferenceState.InSession)
                              .WithMessages(3)
                              .Build();

            conferenceList.Add(conference5);

            var conference6 = new ConferenceBuilder(true, scheduledDateTime: oldHearing)
                              .WithParticipant(UserRole.Representative, "Defendant")
                              .WithParticipant(UserRole.Judge, null)
                              .Build();

            conferenceList.Add(conference6);

            foreach (var c in conferenceList)
            {
                if (c.ClosedDateTime != null &&
                    c.ClosedDateTime.Value.ToUniversalTime() < DateTime.Now.ToUniversalTime().AddMinutes(-30) &&
                    c.InstantMessageHistory.Count > 0)
                {
                    _context.Test.ClosedConferencesWithMessages.Add(c);
                }

                _context.Test.Conferences.Add(await _context.TestDataManager.SeedConference(c));
            }

            var alert1 = new Alert(conference1.Id, conference1.Id, "Disconnected", TaskType.Participant);
            var alert2 = new Alert(conference2.Id, conference2.Id, "Disconnected", TaskType.Participant);
            var alert3 = new Alert(conference3.Id, conference3.Id, "Disconnected", TaskType.Participant);
            var alert4 = new Alert(conference4.Id, conference4.Id, "Disconnected", TaskType.Participant);
            var alert5 = new Alert(conference5.Id, conference5.Id, "Disconnected", TaskType.Participant);
            var alert6 = new Alert(conference6.Id, conference6.Id, "Disconnected", TaskType.Participant);

            _context.Test.Alerts = await _context.TestDataManager.SeedAlerts(new List <Alert>
            {
                alert1, alert2, alert3, alert4, alert5, alert6
            });
        }