Пример #1
0
        public void Should_throw_conference_not_found_exception_when_conference_does_not_exist()
        {
            var conferenceId = Guid.NewGuid();
            var command      = new AddEndpointCommand(conferenceId, "display", "*****@*****.**", "pin", "Defence Sol");

            Assert.ThrowsAsync <ConferenceNotFoundException>(() => _handler.Handle(command));
        }
Пример #2
0
        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);
        }
Пример #3
0
        public async Task <IActionResult> AddEndpointToConference([FromRoute] Guid conferenceId,
                                                                  [FromBody] AddEndpointRequest request)
        {
            _logger.LogDebug("Attempting to add endpoint {DisplayName} to conference", request.DisplayName);

            var command = new AddEndpointCommand(conferenceId, request.DisplayName, request.SipAddress, request.Pin, request.DefenceAdvocate);
            await _commandHandler.Handle(command);

            var conference = await _queryHandler.Handle <GetConferenceByIdQuery, Conference>(new GetConferenceByIdQuery(conferenceId));

            var endpointDtos = conference.GetEndpoints().Select(EndpointMapper.MapToEndpoint);
            await _videoPlatformService.UpdateVirtualCourtRoomAsync(conference.Id, conference.AudioRecordingRequired, endpointDtos);

            _logger.LogDebug("Successfully added endpoint {DisplayName} to conference", request.DisplayName);
            return(NoContent());
        }