Ejemplo n.º 1
0
        private async Task PublishUpdateHearingParticipantsEvent(Hearing hearing, List <ExistingParticipantDetails> existingParticipants, List <NewParticipant> newParticipants,
                                                                 List <Guid> removedParticipantIds, List <LinkedParticipantDto> linkedParticipants)
        {
            var eventNewParticipants = hearing.GetParticipants()
                                       .Where(x => newParticipants.Any(y => y.Person.Username == x.Person.Username)).ToList();

            var eventExistingParticipants = hearing.GetParticipants()
                                            .Where(x => existingParticipants.Any(y => y.ParticipantId == x.Id)).ToList();

            var eventLinkedParticipants = new List <Infrastructure.Services.Dtos.LinkedParticipantDto>();

            foreach (var linkedParticipant in linkedParticipants)
            {
                var primaryLinkedParticipant   = hearing.GetParticipants().SingleOrDefault(x => x.Person.ContactEmail == linkedParticipant.ParticipantContactEmail);
                var secondaryLinkedParticipant = hearing.GetParticipants().SingleOrDefault(x => x.Person.ContactEmail == linkedParticipant.LinkedParticipantContactEmail);

                eventLinkedParticipants.Add(new Infrastructure.Services.Dtos.LinkedParticipantDto
                {
                    LinkedId      = secondaryLinkedParticipant.Id,
                    ParticipantId = primaryLinkedParticipant.Id,
                    Type          = linkedParticipant.Type
                });
            }

            var hearingParticipantsUpdatedIntegrationEvent = new HearingParticipantsUpdatedIntegrationEvent(hearing.Id, eventExistingParticipants, eventNewParticipants,
                                                                                                            removedParticipantIds, eventLinkedParticipants);
            await _eventPublisher.PublishAsync(hearingParticipantsUpdatedIntegrationEvent);
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            _integrationEvent = GetIntegrationEvent();

            _handler = new HearingParticipantsUpdatedHandler(VideoApiServiceMock.Object, VideoWebServiceMock.Object);
        }