Beispiel #1
0
        public async Task should_call_video_api_when_request_has_linked_participants_and_handler_is_called_with_explicit_interface()
        {
            var messageHandler = (IMessageHandler) new ParticipantsAddedHandler(VideoApiServiceMock.Object);

            var integrationEvent = GetIntegrationEventWithLinkedParticipant();
            var dtoList          = MapToRequestFromDto(integrationEvent.Participants[0].LinkedParticipants);
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.AddParticipantsToConference(It.IsAny <Guid>(), It.Is <AddParticipantsToConferenceRequest>
                                                                          (
                                                                              request =>
                                                                              request.Participants.Count == 1 &&
                                                                              request.Participants[0].Name == integrationEvent.Participants[0].Fullname &&
                                                                              request.Participants[0].Username == integrationEvent.Participants[0].Username &&
                                                                              request.Participants[0].FirstName == integrationEvent.Participants[0].FirstName &&
                                                                              request.Participants[0].LastName == integrationEvent.Participants[0].LastName &&
                                                                              request.Participants[0].ContactEmail == integrationEvent.Participants[0].ContactEmail &&
                                                                              request.Participants[0].ContactTelephone == integrationEvent.Participants[0].ContactTelephone &&
                                                                              request.Participants[0].DisplayName == integrationEvent.Participants[0].DisplayName &&
                                                                              request.Participants[0].UserRole.ToString() == integrationEvent.Participants[0].UserRole &&
                                                                              request.Participants[0].HearingRole == integrationEvent.Participants[0].HearingRole &&
                                                                              request.Participants[0].CaseTypeGroup == integrationEvent.Participants[0].CaseGroupType.ToString() &&
                                                                              request.Participants[0].ParticipantRefId == integrationEvent.Participants[0].ParticipantId &&
                                                                              request.Participants[0].Representee == integrationEvent.Participants[0].Representee &&
                                                                              request.Participants[0].LinkedParticipants.Count.Equals(1) &&
                                                                              request.Participants[0].LinkedParticipants[0].Type == dtoList[0].Type &&
                                                                              request.Participants[0].LinkedParticipants[0].ParticipantRefId == dtoList[0].ParticipantRefId &&
                                                                              request.Participants[0].LinkedParticipants[0].LinkedRefId == dtoList[0].LinkedRefId
                                                                          )), Times.Once);
        }
        public async Task should_call_video_api_when_handle_is_called_with_explicit_interface_with_linked_participant()
        {
            var messageHandler =
                (IMessageHandler) new ParticipantUpdatedHandler(VideoApiServiceMock.Object, _logger.Object);
            var integrationEvent = GetIntegrationEventWithLinkedParticipant();
            var dtoList          = MapToRequestFromDto(integrationEvent.Participant.LinkedParticipants);

            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.UpdateParticipantDetails(It.IsAny <Guid>(), It.IsAny <Guid>(),
                                                                       It.Is <UpdateParticipantRequest>
                                                                       (
                                                                           request =>
                                                                           request.DisplayName == integrationEvent.Participant.DisplayName &&
                                                                           request.FirstName == integrationEvent.Participant.FirstName &&
                                                                           request.LastName == integrationEvent.Participant.LastName &&
                                                                           request.Representee == integrationEvent.Participant.Representee &&
                                                                           request.ContactEmail == integrationEvent.Participant.ContactEmail &&
                                                                           request.ContactTelephone == integrationEvent.Participant.ContactTelephone &&
                                                                           request.Fullname == integrationEvent.Participant.Fullname &&
                                                                           request.Username == integrationEvent.Participant.Username &&
                                                                           request.LinkedParticipants.Count.Equals(1) &&
                                                                           request.LinkedParticipants[0].Type == dtoList[0].Type &&
                                                                           request.LinkedParticipants[0].ParticipantRefId == dtoList[0].ParticipantRefId &&
                                                                           request.LinkedParticipants[0].LinkedRefId == dtoList[0].LinkedRefId
                                                                       )), Times.Once);
        }
        public async Task should_call_video_api_when_request_is_valid()
        {
            var messageHandler = new EndpointAddedHandler(VideoApiServiceMock.Object);

            var integrationEvent = GetIntegrationEvent();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.AddEndpointToConference(It.IsAny <Guid>(), It.IsAny <AddEndpointRequest>()), Times.Once);
        }
        public async Task should_call_video_api_when_handle_is_called_with_explicit_interface()
        {
            var messageHandler = (IMessageHandler) new HearingDetailsUpdatedHandler(VideoApiServiceMock.Object);

            var integrationEvent = GetIntegrationEvent();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.UpdateConferenceAsync(It.IsAny <UpdateConferenceRequest>()), Times.Once);
        }
        public async Task should_call_video_api_when_request_is_valid()
        {
            var messageHandler = new HearingReadyForVideoHandler(VideoApiServiceMock.Object);

            var integrationEvent = CreateEvent();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.BookNewConferenceAsync(It.IsAny <BookNewConferenceRequest>()), Times.Once);
        }
Beispiel #6
0
        public async Task should_call_video_api_when_handle_is_called_with_explicit_interface()
        {
            var messageHandler = (IMessageHandler) new EndpointRemovedHandler(VideoApiServiceMock.Object);

            var integrationEvent = GetIntegrationEvent();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.RemoveEndpointFromConference(It.IsAny <Guid>(), It.IsAny <string>()), Times.Once);
        }
        public async Task should_call_video_api_when_request_has_linked_participants_and_is_valid()
        {
            var messageHandler = new ParticipantsAddedHandler(VideoApiServiceMock.Object, VideoWebServiceMock.Object);

            var integrationEvent = GetIntegrationEvent();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.AddParticipantsToConference(It.IsAny <Guid>(), It.IsAny <AddParticipantsToConferenceRequest>()), Times.Once);
        }
        public async Task should_call_video_api_when_handle_is_called_with_explicit_interface()
        {
            var messageHandler = (IMessageHandler) new HearingCancelledHandler(VideoApiServiceMock.Object);

            var integrationEvent = new HearingCancelledIntegrationEvent {
                HearingId = HearingId
            };
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.DeleteConferenceAsync(It.IsAny <Guid>()), Times.Once);
        }
        public async Task should_call_video_api_when_handle_is_called_with_explicit_interface()
        {
            var messageHandler = (IMessageHandler) new HearingReadyForVideoHandler(VideoApiServiceMock.Object, VideoWebServiceMock.Object);

            VideoApiServiceMock.Setup(x => x.BookNewConferenceAsync(It.IsAny <BookNewConferenceRequest>())).ReturnsAsync(new ConferenceDetailsResponse());

            var integrationEvent = CreateEvent();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.BookNewConferenceAsync(It.IsAny <BookNewConferenceRequest>()), Times.Once);
        }
        public async Task should_call_video_api_when_request_is_valid_with_linked_participant()
        {
            var messageHandler = new ParticipantUpdatedHandler(VideoApiServiceMock.Object, _logger.Object);

            var integrationEvent = GetIntegrationEventWithLinkedParticipant();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(
                x => x.UpdateParticipantDetails(It.IsAny <Guid>(), It.IsAny <Guid>(),
                                                It.IsAny <UpdateParticipantRequest>()), Times.Once);
        }
        public async Task should_call_video_api_when_request_is_valid()
        {
            var messageHandler = new ParticipantRemovedHandler(VideoApiServiceMock.Object);

            var integrationEvent = new ParticipantRemovedIntegrationEvent {
                HearingId = HearingId, ParticipantId = ParticipantId
            };
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.RemoveParticipantFromConference(It.IsAny <Guid>(), It.IsAny <Guid>()), Times.Once);
        }
        public async Task should_call_video_api_when_handle_is_called_with_explicit_interface()
        {
            var messageHandler = (IMessageHandler) new EndpointUpdatedHandler(VideoApiServiceMock.Object);

            var integrationEvent = GetIntegrationEvent();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.UpdateEndpointInConference(It.IsAny <Guid>(), It.IsAny <string>(),
                                                                         It.Is <UpdateEndpointRequest>
                                                                         (
                                                                             request => request.DisplayName == integrationEvent.DisplayName &&
                                                                             request.DefenceAdvocate == integrationEvent.DefenceAdvocate
                                                                         )), Times.Once);
        }
        public async Task should_call_video_api_when_handle_is_called_with_explicit_interface()
        {
            var messageHandler =
                (IMessageHandler) new ParticipantUpdatedHandler(VideoApiServiceMock.Object, _logger.Object);

            var integrationEvent = GetIntegrationEvent();
            await messageHandler.HandleAsync(integrationEvent);

            VideoApiServiceMock.Verify(x => x.UpdateParticipantDetails(It.IsAny <Guid>(), It.IsAny <Guid>(),
                                                                       It.Is <UpdateParticipantRequest>
                                                                       (
                                                                           request =>
                                                                           request.DisplayName == integrationEvent.Participant.DisplayName &&
                                                                           request.FirstName == integrationEvent.Participant.FirstName &&
                                                                           request.LastName == integrationEvent.Participant.LastName &&
                                                                           request.Representee == integrationEvent.Participant.Representee &&
                                                                           request.ContactEmail == integrationEvent.Participant.ContactEmail &&
                                                                           request.ContactTelephone == integrationEvent.Participant.ContactTelephone &&
                                                                           request.Fullname == integrationEvent.Participant.Fullname &&
                                                                           request.Username == integrationEvent.Participant.Username
                                                                       )), Times.Once);
        }
Beispiel #14
0
        public async Task should_call_video_api_to_update_conference_participants()
        {
            await _handler.HandleAsync(_integrationEvent);

            VideoApiServiceMock.Verify(x => x.UpdateConferenceParticipantsAsync(ConferenceDetailsResponse.Id,
                                                                                It.Is <UpdateConferenceParticipantsRequest>(r =>
                                                                                                                            r.ExistingParticipants[0].ContactEmail == _integrationEvent.ExistingParticipants[0].ContactEmail &&
                                                                                                                            r.ExistingParticipants[0].ContactTelephone == _integrationEvent.ExistingParticipants[0].ContactTelephone &&
                                                                                                                            r.ExistingParticipants[0].DisplayName == _integrationEvent.ExistingParticipants[0].DisplayName &&
                                                                                                                            r.ExistingParticipants[0].FirstName == _integrationEvent.ExistingParticipants[0].FirstName &&
                                                                                                                            r.ExistingParticipants[0].Fullname == _integrationEvent.ExistingParticipants[0].Fullname &&
                                                                                                                            r.ExistingParticipants[0].LastName == _integrationEvent.ExistingParticipants[0].LastName &&
                                                                                                                            r.ExistingParticipants[0].ParticipantRefId == _integrationEvent.ExistingParticipants[0].ParticipantId &&
                                                                                                                            r.ExistingParticipants[0].Representee == _integrationEvent.ExistingParticipants[0].Representee &&
                                                                                                                            r.ExistingParticipants[0].Username == _integrationEvent.ExistingParticipants[0].Username

                                                                                                                            && r.NewParticipants[0].CaseTypeGroup == _integrationEvent.NewParticipants[0].CaseGroupType.ToString() &&
                                                                                                                            r.NewParticipants[0].ContactEmail == _integrationEvent.NewParticipants[0].ContactEmail &&
                                                                                                                            r.NewParticipants[0].ContactTelephone == _integrationEvent.NewParticipants[0].ContactTelephone &&
                                                                                                                            r.NewParticipants[0].DisplayName == _integrationEvent.NewParticipants[0].DisplayName &&
                                                                                                                            r.NewParticipants[0].FirstName == _integrationEvent.NewParticipants[0].FirstName &&
                                                                                                                            r.NewParticipants[0].HearingRole == _integrationEvent.NewParticipants[0].HearingRole &&
                                                                                                                            r.NewParticipants[0].LastName == _integrationEvent.NewParticipants[0].LastName &&
                                                                                                                            r.NewParticipants[0].Name == _integrationEvent.NewParticipants[0].Fullname &&
                                                                                                                            r.NewParticipants[0].ParticipantRefId == _integrationEvent.NewParticipants[0].ParticipantId &&
                                                                                                                            r.NewParticipants[0].Representee == _integrationEvent.NewParticipants[0].Representee &&
                                                                                                                            r.NewParticipants[0].UserRole == VideoApi.Contract.Enums.UserRole.Individual &&
                                                                                                                            r.NewParticipants[0].Username == _integrationEvent.NewParticipants[0].Username

                                                                                                                            && r.RemovedParticipants == _integrationEvent.RemovedParticipants

                                                                                                                            && r.LinkedParticipants[0].LinkedRefId == _integrationEvent.LinkedParticipants[0].LinkedId &&
                                                                                                                            r.LinkedParticipants[0].ParticipantRefId == _integrationEvent.LinkedParticipants[0].ParticipantId &&
                                                                                                                            r.LinkedParticipants[0].Type == VideoApi.Contract.Enums.LinkedParticipantType.Interpreter
                                                                                                                            )), Times.Once);
        }
Beispiel #15
0
        public async Task should_call_video_api_to_retrieve_conference()
        {
            await _handler.HandleAsync(_integrationEvent);

            VideoApiServiceMock.Verify(x => x.GetConferenceByHearingRefId(HearingId, true), Times.Once);
        }