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(); }
public async Task Should_not_anonymise_data_for_future_hearings() { conferenceList = new List <Domain.Conference>(); var utcDate = DateTime.UtcNow; var futureHearing = utcDate.AddMonths(1); var conference3 = new ConferenceBuilder(true, scheduledDateTime: futureHearing) .WithParticipant(UserRole.Representative, "Respondent") .WithParticipant(UserRole.Judge, null) .WithConferenceStatus(ConferenceState.InSession) .Build(); _conference3Id = conference3.Id; conferenceList.Add(conference3); var conference3Rep = conference3.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(conference3.Id)); conference.Should().NotBeNull(); conference.CaseName.Should().Be(conference3.CaseName); var representative = conference.Participants.FirstOrDefault(p => p.UserRole == UserRole.Representative); representative.DisplayName.Should().Be(conference3Rep.DisplayName); }
public async Task Should_update_existing_endpoint_with_new_status_and_room() { var conference1 = new ConferenceBuilder() .WithEndpoint("DisplayName", "*****@*****.**").Build(); var seededConference = await TestDataManager.SeedConference(conference1); var endpointId = conference1.Endpoints.First().Id; const EndpointState status = EndpointState.Connected; const RoomType room = RoomType.HearingRoom; TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var command = new UpdateEndpointStatusAndRoomCommand(_newConferenceId, endpointId, status, room); 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); } var updatedEndpoint = updatedConference.GetEndpoints().Single(x => x.Id == endpointId); updatedEndpoint.State.Should().Be(status); updatedEndpoint.GetCurrentRoom().Should().Be(room); }
public async Task Should_update_existing_endpoint_with_defence_advocate() { var conference1 = new ConferenceBuilder() .WithEndpoint("DisplayName", "*****@*****.**").Build(); var seededConference = await TestDataManager.SeedConference(conference1); var ep = conference1.Endpoints.First(); var sipAddress = ep.SipAddress; var defenceAdvocate = "Sol Defence"; TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var command = new UpdateEndpointCommand(_newConferenceId, sipAddress, null, defenceAdvocate); await _handler.Handle(command); Conference updatedConference; await using (var db = new VideoApiDbContext(VideoBookingsDbContextOptions)) { updatedConference = await db.Conferences.Include(x => x.Endpoints) .AsNoTracking().SingleAsync(x => x.Id == _newConferenceId); } var updatedEndpoint = updatedConference.GetEndpoints().Single(x => x.SipAddress == sipAddress); updatedEndpoint.DisplayName.Should().Be(ep.DisplayName); updatedEndpoint.DefenceAdvocate.Should().Be(defenceAdvocate); }
public async Task Should_retrieve_all_messages_for_the_participant() { var conference = new ConferenceBuilder(true) .WithParticipant(UserRole.Individual, "Claimant") .WithParticipant(UserRole.Judge, "Judge") .Build(); var judge = conference.GetParticipants().First(x => x.UserRole == UserRole.Judge); var participant = conference.GetParticipants().First(x => x.UserRole == UserRole.Individual); var vhOfficer = "VH Officer"; conference.AddInstantMessage(vhOfficer, "InstantMessage 1", judge.DisplayName); conference.AddInstantMessage(judge.DisplayName, "InstantMessage 2", vhOfficer); conference.AddInstantMessage(participant.Username, "Hello VHO", vhOfficer); conference.AddInstantMessage(vhOfficer, "Hello ParticipantOne", participant.Username); var seededConference = await TestDataManager.SeedConference(conference); _newConferenceId = seededConference.Id; var query = new GetInstantMessagesForConferenceQuery(_newConferenceId, participant.Username); var results = await _handler.Handle(query); results.Count.Should().Be(conference.GetInstantMessageHistoryFor(participant.Username).Count); results.Should().BeInDescendingOrder(x => x.TimeStamp); }
public async Task Should_add_an_task(TaskType taskType) { var seededConference = await TestDataManager.SeedConference(); _newConferenceId = seededConference.Id; const string body = "Automated Test Add Task"; var command = CreateTaskCommand(seededConference, body, taskType); await _handler.Handle(command); List <Domain.Task> tasks; await using (var db = new VideoApiDbContext(VideoBookingsDbContextOptions)) { tasks = await db.Tasks.Where(x => x.ConferenceId == command.ConferenceId).ToListAsync(); } var savedAlert = tasks.First(x => x.Body == body && x.Type == taskType); savedAlert.Should().NotBeNull(); savedAlert.Status.Should().Be(TaskStatus.ToDo); savedAlert.Updated.Should().BeNull(); savedAlert.UpdatedBy.Should().BeNull(); savedAlert.ConferenceId.Should().Be(command.ConferenceId); }
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); }
public async Task should_add_endpoint_to_conference() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var displayName = "display1"; var sip = "*****@*****.**"; var pin = "123"; var defenceAdvocate = "Defence Sol"; var command = new AddEndpointCommand(_newConferenceId, displayName, sip, pin, defenceAdvocate); await _handler.Handle(command); Conference updatedConference; await using (var db = new VideoApiDbContext(VideoBookingsDbContextOptions)) { updatedConference = await db.Conferences.Include(x => x.Endpoints).SingleOrDefaultAsync(x => x.Id == _newConferenceId); } updatedConference.GetEndpoints().Should().NotBeEmpty(); var ep = updatedConference.Endpoints.First(); ep.Pin.Should().Be(pin); ep.SipAddress.Should().Be(sip); ep.DisplayName.Should().Be(displayName); ep.Id.Should().NotBeEmpty(); ep.DefenceAdvocate.Should().Be(defenceAdvocate); ep.State.Should().Be(EndpointState.NotYetJoined); }
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, "Applicant", "*****@*****.**", "Applicant", null, ParticipantState.None) .WithParticipant(UserRole.Individual, "Applicant", "*****@*****.**", "Applicant", null, ParticipantState.None) .Build(); _conferenceIds.Add(newConference.Id); await TestDataManager.SeedConference(newConference); // anonymised data newConference = new ConferenceBuilder(true) .WithParticipant(UserRole.Judge, "Judge", "[email protected]", "JudgeLondon", null, ParticipantState.None) .WithParticipant(UserRole.Representative, "Applicant", "*****@*****.**", "Applicant", null, ParticipantState.None) .WithParticipant(UserRole.Individual, "Applicant", "*****@*****.**", "Applicant", null, ParticipantState.None) .Build(); _conferenceIds.Add(newConference.Id); await TestDataManager.SeedConference(newConference); var judgeList = await _handler.Handle(new GetDistinctJudgeListByFirstNameQuery()); judgeList.Should().NotBeEmpty(); judgeList.Should().NotContain("JudgeLondon"); }
public async Task should_add_participant_to_interpreter_room() { var conference = await TestDataManager.SeedConference(); _newConferenceId = conference.Id; var interpreterRoom = new ParticipantRoom(_newConferenceId, "InterpreterRoom1", VirtualCourtRoomType.Witness); var rooms = await TestDataManager.SeedRooms(new[] { interpreterRoom }); interpreterRoom = (ParticipantRoom)rooms[0]; var participant = conference.Participants.First(x => x.UserRole == UserRole.Individual); var command = new AddParticipantToParticipantRoomCommand(interpreterRoom.Id, participant.Id); await _handler.Handle(command); await using var db = new VideoApiDbContext(VideoBookingsDbContextOptions); var updatedRoom = await db.Rooms.OfType <ParticipantRoom>().AsNoTracking() .Include(r => r.RoomParticipants) .SingleAsync(r => r.Id == interpreterRoom.Id); updatedRoom.RoomParticipants.Any(p => p.ParticipantId == participant.Id).Should().BeTrue(); var updatedParticipantFromDb = await db.Participants.Include(x => x.RoomParticipants).ThenInclude(x => x.Room).AsNoTracking() .SingleAsync(p => p.Id == participant.Id); updatedParticipantFromDb.RoomParticipants.Any(r => r.RoomId == interpreterRoom.Id).Should().BeTrue(); var updatedConference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(_newConferenceId)); var updatedParticipant = updatedConference.Participants.First(x => x.Id == participant.Id); updatedParticipant.GetParticipantRoom().Should().NotBeNull(); updatedParticipant.GetParticipantRoom().Id.Should().Be(interpreterRoom.Id); }
public async Task Should_update_participant_username_when_provided() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var participant = seededConference.GetParticipants().First(); var command = new UpdateParticipantDetailsCommand(_newConferenceId, participant.Id, "fullname", "firstName", "lastName", "displayname", String.Empty, "*****@*****.**", "0123456789", new List <LinkedParticipantDto>()) { Username = "******" }; await _handler.Handle(command); var updatedConference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(_newConferenceId)); var updatedParticipant = updatedConference.GetParticipants().Single(x => x.Id == participant.Id); updatedParticipant.DisplayName.Should().Be("displayname"); updatedParticipant.Name.Should().Be("fullname"); updatedParticipant.FirstName.Should().Be("firstName"); updatedParticipant.LastName.Should().Be("lastName"); updatedParticipant.ContactEmail.Should().Be("*****@*****.**"); updatedParticipant.ContactTelephone.Should().Be("0123456789"); updatedParticipant.Username.Should().Be(command.Username); }
public async Task Should_get_non_closed_conference() { var knownHearingRefId = Guid.NewGuid(); var conference1 = new ConferenceBuilder(true, knownHearingRefId) .WithParticipant(UserRole.Representative, "Defendant") .WithParticipant(UserRole.Judge, null) .WithConferenceStatus(ConferenceState.Closed) .Build(); _newConferenceId1 = conference1.Id; var conference2 = new ConferenceBuilder(true, knownHearingRefId) .WithParticipant(UserRole.Representative, "Defendant") .WithParticipant(UserRole.Judge, null) .WithConferenceStatus(ConferenceState.InSession) .Build(); _newConferenceId2 = conference2.Id; await TestDataManager.SeedConference(conference1); await TestDataManager.SeedConference(conference2); var conference = await _handler.Handle(new GetNonClosedConferenceByHearingRefIdQuery(knownHearingRefId)); AssertConference(conference, conference2, true); }
public async Task should_update_room_with_new_details() { var seededConference = await TestDataManager.SeedConference(); _newConferenceId = seededConference.Id; var room = new ParticipantRoom(_newConferenceId, VirtualCourtRoomType.Civilian); await TestDataManager.SeedRooms(new [] { room }); var label = "Interpreter1"; var ingestUrl = "dummyurl"; var node = "node"; var uri = "fakeuri"; var command = new UpdateParticipantRoomConnectionDetailsCommand(_newConferenceId, room.Id, label, ingestUrl, node, uri); await _handler.Handle(command); var roomId = command.RoomId; await using var db = new VideoApiDbContext(VideoBookingsDbContextOptions); var updatedRoom = await db.Rooms.OfType <ParticipantRoom>().AsNoTracking() .SingleAsync(c => c.Id == roomId); updatedRoom.Label.Should().Be(label); updatedRoom.IngestUrl.Should().Be(ingestUrl); updatedRoom.PexipNode.Should().Be(node); updatedRoom.ParticipantUri.Should().Be(uri); }
public async Task Should_add_participant_to_conference() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var beforeCount = seededConference.GetParticipants().Count; var participant = new ParticipantBuilder(true).Build(); var participants = new List <Participant>() { participant }; var command = new AddParticipantsToConferenceCommand(_newConferenceId, participants, new List <LinkedParticipantDto>()); await _handler.Handle(command); var conference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(_newConferenceId)); var confParticipants = conference.GetParticipants(); confParticipants.Any(x => x.Username == participant.Username).Should().BeTrue(); var afterCount = conference.GetParticipants().Count; afterCount.Should().BeGreaterThan(beforeCount); }
public async Task Should_add_a_message() { var seededConference = await TestDataManager.SeedConference(); _newConferenceId = seededConference.Id; var participants = seededConference.Participants; var from = participants.First(x => x.UserRole == UserRole.Judge).DisplayName; var messageText = Internet.DomainWord(); var to = "VH Officer"; var command = new AddInstantMessageCommand(_newConferenceId, from, messageText, to); await _handler.Handle(command); List <InstantMessage> instantMessages; using (var db = new VideoApiDbContext(VideoBookingsDbContextOptions)) { instantMessages = await db.InstantMessages .Where(x => x.ConferenceId == command.ConferenceId).ToListAsync(); } var message = instantMessages.First(); message.Should().NotBeNull(); message.From.Should().Be(from); message.MessageText.Should().Be(messageText); message.TimeStamp.Should().BeBefore(DateTime.UtcNow); message.ConferenceId.Should().Be(command.ConferenceId); message.To.Should().Be(to); }
public async Task Should_return_conferences_still_open_after_14_hours() { var utcDate = DateTime.UtcNow; var expired = utcDate.AddHours(-15); var withinTimeLimit = utcDate.AddHours(-10); var beyondTimeLimit = utcDate.AddHours(10); var conference1 = new ConferenceBuilder(true, scheduledDateTime: expired) .WithParticipant(UserRole.Representative, "Respondent") .WithParticipant(UserRole.Judge, null) .WithConferenceStatus(ConferenceState.InSession) .Build(); _conference1Id = conference1.Id; var conference2 = new ConferenceBuilder(true, scheduledDateTime: withinTimeLimit) .WithParticipant(UserRole.Representative, "Respondent") .WithParticipant(UserRole.Judge, null) .WithConferenceStatus(ConferenceState.InSession) .Build(); _conference2Id = conference2.Id; var conference3 = new ConferenceBuilder(true, scheduledDateTime: beyondTimeLimit) .WithParticipant(UserRole.Representative, "Respondent") .WithParticipant(UserRole.Judge, null) .WithConferenceStatus(ConferenceState.Paused) .Build(); _conference3Id = conference3.Id; var conference4 = new ConferenceBuilder(true, scheduledDateTime: expired) .WithParticipant(UserRole.Representative, "Respondent") .WithParticipant(UserRole.Judge, null) .WithConferenceStatus(ConferenceState.Closed) .Build(); _conference4Id = conference4.Id; await TestDataManager.SeedConference(conference1); await TestDataManager.SeedConference(conference2); await TestDataManager.SeedConference(conference3); await TestDataManager.SeedConference(conference4); var conferences = await _handler.Handle(new GetExpiredUnclosedConferencesQuery()); var confIds = conferences.Select(x => x.Id).ToList(); confIds.Should().Contain(conference1.Id); var notExpectedConferences = new List <Guid> { conference2.Id, conference3.Id, conference4.Id }; confIds.Should() .NotContain(notExpectedConferences); }
public async Task Should_remove_messages_for_conference() { var conference = new ConferenceBuilder(true) .WithMessages(2) .Build(); var seededConference = await TestDataManager.SeedConference(conference); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var command = new RemoveInstantMessagesForConferenceCommand(_newConferenceId); await _handler.Handle(command); List <InstantMessage> messages; await using (var db = new VideoApiDbContext(VideoBookingsDbContextOptions)) { messages = await db.InstantMessages.Where(x => x.ConferenceId == command.ConferenceId).ToListAsync(); } var afterCount = messages.Count; afterCount.Should().Be(0); }
public async Task Should_throw_exception_when_endpoint_does_not_exist() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var command = new RemoveEndpointCommand(_newConferenceId, "*****@*****.**"); Assert.ThrowsAsync <EndpointNotFoundException>(async() => await _handler.Handle(command)); }
public async Task should_return_empty_list_of_endpoints() { var seededConference = await TestDataManager.SeedConference(); _newConferenceId = seededConference.Id; var query = new GetEndpointsForConferenceQuery(_newConferenceId); var result = await _handler.Handle(query); result.Should().BeEmpty(); }
public async Task Should_throw_participant_not_found_exception_when_participant_does_not_exist() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var participantId = Guid.NewGuid(); var command = new UpdateSelfTestCallResultCommand(_newConferenceId, participantId, true, TestScore.Good); Assert.ThrowsAsync <ParticipantNotFoundException>(() => _handler.Handle(command)); }
public async Task Should_get_conference_details_by_hearing_ref_id() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId1 = seededConference.Id; var conference = await _handler.Handle(new GetNonClosedConferenceByHearingRefIdQuery(seededConference.HearingRefId)); AssertConference(conference, seededConference); }
private async Task CreateConference(string judge) { var newConference = new ConferenceBuilder(true) .WithParticipant(UserRole.Representative, "Respondent") .WithParticipant(UserRole.Judge, null, firstName: judge) .Build(); _conferenceIds.Add(newConference.Id); await TestDataManager.SeedConference(newConference); }
public async Task Should_update_participant_details_and_linked_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(); var participantC = 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); conference.Participants.Add(participantC); var seededConference = await TestDataManager.SeedConference(conference); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var participant = seededConference.GetParticipants().First(); var newLinkedParticipants = new List <LinkedParticipantDto>() { new LinkedParticipantDto() { ParticipantRefId = participantC.ParticipantRefId, LinkedRefId = participantA.ParticipantRefId, Type = LinkedParticipantType.Interpreter }, new LinkedParticipantDto() { ParticipantRefId = participantA.ParticipantRefId, LinkedRefId = participantC.ParticipantRefId, Type = LinkedParticipantType.Interpreter } }; var command = new UpdateParticipantDetailsCommand(_newConferenceId, participant.Id, "fullname", "firstName", "lastName", "displayname", String.Empty, "*****@*****.**", "0123456789", newLinkedParticipants); await _handler.Handle(command); var updatedConference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(_newConferenceId)); var updatedParticipant = updatedConference.GetParticipants().Single(x => x.Username == participant.Username); updatedParticipant.LinkedParticipants.Should().NotContain(x => x.LinkedId == participantB.Id); updatedParticipant.LinkedParticipants.Should().Contain(x => x.LinkedId == participantC.Id); }
public async Task Should_return_conferences_with_audiorecording_expired_14_hours_ago() { var utcDate = DateTime.UtcNow; var expired = utcDate.AddHours(-15); var withinTimeLimit = utcDate.AddHours(-10); var beyondTimeLimit = utcDate.AddHours(10); var beyondTimeLimitMax = utcDate.AddHours(-39); var conference1 = GetTestDataConference(expired, true, ConferenceState.Closed); _conference1Id = conference1.Id; var conference2 = GetTestDataConference(withinTimeLimit, false, ConferenceState.InSession); _conference2Id = conference2.Id; var conference3 = GetTestDataConference(beyondTimeLimit, false, ConferenceState.Paused); _conference3Id = conference3.Id; var conference4 = GetTestDataConference(expired, true, ConferenceState.Paused); _conference4Id = conference4.Id; var conference5 = GetTestDataConference(beyondTimeLimitMax, true, ConferenceState.Closed); _conference5Id = conference5.Id; await TestDataManager.SeedConference(conference1); await TestDataManager.SeedConference(conference2); await TestDataManager.SeedConference(conference3); await TestDataManager.SeedConference(conference4); await TestDataManager.SeedConference(conference5); var conferences = await _handler.Handle(new GetExpiredAudiorecordingConferencesQuery()); var confIds = conferences.Select(x => x.Id).ToList(); confIds.Should().Contain(conference1.Id); confIds.Should().Contain(conference4.Id); var notExpectedConferences = new List <Guid> { conference2.Id, conference3.Id, conference5.Id }; confIds.Should() .NotContain(notExpectedConferences); }
public async Task Should_throw_exception_when_endpoint_does_not_exist() { var seededConference = await TestDataManager.SeedConference(); var endpointId = Guid.NewGuid(); const EndpointState status = EndpointState.Connected; TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var command = new UpdateEndpointStatusAndRoomCommand(_newConferenceId, endpointId, status, null); Assert.ThrowsAsync <EndpointNotFoundException>(async() => await _handler.Handle(command)); }
public async Task Should_return_conference_when_query_is_matched() { var seededConference = await TestDataManager.SeedConference(); var query = new CheckConferenceOpenQuery(seededConference.ScheduledDateTime, seededConference.CaseNumber, seededConference.CaseName); var conference = await _handler.Handle(query); conference.Should().NotBeNull(); conference.Id.Should().Be(seededConference.Id); _newConferenceId = seededConference.Id; }
public async Task Should_throw_participant_not_found_exception_when_participant_does_not_exist() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var participantId = Guid.NewGuid(); var command = new UpdateParticipantDetailsCommand(_newConferenceId, participantId, "fullname", "firstName", "lastName", "displayname", String.Empty, "*****@*****.**", "1234"); Assert.ThrowsAsync <ParticipantNotFoundException>(() => _handler.Handle(command)); }
public async Task Should_throw_participant_link_exception_when_id_doesnt_match() { 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(); var participantC = 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); conference.Participants.Add(participantC); var seededConference = await TestDataManager.SeedConference(conference); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var participant = seededConference.GetParticipants().First(); var fakeIdA = Guid.NewGuid(); var fakeIdC = Guid.NewGuid(); var newLinkedParticipants = new List <LinkedParticipantDto>() { new LinkedParticipantDto() { ParticipantRefId = fakeIdC, LinkedRefId = participantA.ParticipantRefId, Type = LinkedParticipantType.Interpreter }, new LinkedParticipantDto() { ParticipantRefId = fakeIdA, LinkedRefId = participantC.ParticipantRefId, Type = LinkedParticipantType.Interpreter } }; var command = new UpdateParticipantDetailsCommand(_newConferenceId, participant.Id, "fullname", "firstName", "lastName", "displayname", String.Empty, "*****@*****.**", "0123456789", newLinkedParticipants); var exception = Assert.ThrowsAsync <ParticipantLinkException>(() => _handler.Handle(command)); exception.LinkRefId.Should().Be(participantA.ParticipantRefId); exception.ParticipantRefId.Should().Be(fakeIdC); }
public async Task Should_throw_participant_not_found_exception_when_participant_does_not_exist() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var participantId = Guid.NewGuid(); var state = ParticipantState.InConsultation; var room = RoomType.ConsultationRoom1; var command = new UpdateParticipantStatusAndRoomCommand(_newConferenceId, participantId, state, room); Assert.ThrowsAsync <ParticipantNotFoundException>(() => _handler.Handle(command)); }
public async Task should_return_list_of_endpoints() { var conference1 = new ConferenceBuilder() .WithEndpoint("Display1", "*****@*****.**") .WithEndpoint("Display2", "*****@*****.**").Build(); _newConferenceId = conference1.Id; await TestDataManager.SeedConference(conference1); var query = new GetEndpointsForConferenceQuery(_newConferenceId); var result = await _handler.Handle(query); result.Should().BeEquivalentTo(conference1.GetEndpoints()); }