protected static VideoHearing GetHearing(string caseNumber) { var hearing = new VideoHearingBuilder().Build(); if (!caseNumber.IsNullOrEmpty()) { hearing.AddCase(caseNumber, "Case name", true); } foreach (var participant in hearing.Participants) { participant.HearingRole = new HearingRole(1, "Name") { UserRole = new UserRole(1, "User"), }; participant.CaseRole = new CaseRole(1, "Name"); } hearing.AddEndpoints(new List <Endpoint> { new Endpoint("new endpoint", Guid.NewGuid().ToString(), "pin", null) }); return(hearing); }
public void Should_publish_message_to_queue_when_HearingIsReadyForVideoIntegrationEvent_is_raised() { var hearing = new VideoHearingBuilder().Build(); hearing.CaseType = new CaseType(1, "test"); hearing.AddCase("1234", "test", true); var individuals = hearing.GetParticipants().Where(x => x is Individual).ToList(); var individual1 = individuals.First(); individual1.CaseRole = new CaseRole(1, "test"); var individual2 = individuals.Last(); individual2.CaseRole = new CaseRole(2, "test2"); var representative = hearing.GetParticipants().Single(x => x is Representative); representative.CaseRole = new CaseRole(3, "test3"); var judge = hearing.GetParticipants().Single(x => x is Judge); judge.CaseRole = new CaseRole(3, "test4"); var joh = hearing.GetParticipants().Single(x => x is JudicialOfficeHolder); joh.CaseRole = new CaseRole(4, "test5"); var staffMember = hearing.GetParticipants().Single(x => x is StaffMember); staffMember.CaseRole = new CaseRole(5, "test5"); hearing.AddEndpoints(new List <Endpoint> { new Endpoint("one", Guid.NewGuid().ToString(), "1234", null), new Endpoint("two", Guid.NewGuid().ToString(), "1234", representative) }); var hearingIsReadyForVideoIntegrationEvent = new HearingIsReadyForVideoIntegrationEvent(hearing); _eventPublisher.PublishAsync(hearingIsReadyForVideoIntegrationEvent); _serviceBusQueueClient.Count.Should().Be(1); var @event = _serviceBusQueueClient.ReadMessageFromQueue(); @event.IntegrationEvent.Should().BeOfType <HearingIsReadyForVideoIntegrationEvent>(); var typedEvent = (HearingIsReadyForVideoIntegrationEvent)@event.IntegrationEvent; typedEvent.Hearing.RecordAudio.Should().Be(hearing.AudioRecordingRequired); typedEvent.Participants.Count.Should().Be(hearing.GetParticipants().Count); typedEvent.Endpoints.Should().NotBeNull(); typedEvent.Endpoints.Count.Should().Be(hearing.GetEndpoints().Count); }
public void Should_remove_endpoint_from_hearing() { var hearing = new VideoHearingBuilder().Build(); hearing.AddEndpoints(new List <Endpoint> { new Endpoint("new endpoint1", Guid.NewGuid().ToString(), "pin", null), new Endpoint("new endpoint2", Guid.NewGuid().ToString(), "pin", null), new Endpoint("new endpoint2", Guid.NewGuid().ToString(), "pin", null) }); var beforeRemoveCount = hearing.GetEndpoints().Count; hearing.RemoveEndpoint(hearing.GetEndpoints().First()); var afterRemoveCount = hearing.GetEndpoints().Count; afterRemoveCount.Should().BeLessThan(beforeRemoveCount); }