public void Should_throw_conference_not_found_exception_when_conference_does_not_exist() { var conferenceId = Guid.NewGuid(); var command = new RemoveEndpointCommand(conferenceId, "*****@*****.**"); Assert.ThrowsAsync <ConferenceNotFoundException>(() => _handler.Handle(command)); }
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 <IActionResult> RemoveEndpointFromConference(Guid conferenceId, string sipAddress) { _logger.LogDebug("Attempting to remove endpoint {sipAddress} from conference", sipAddress); var command = new RemoveEndpointCommand(conferenceId, sipAddress); 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 removed endpoint {sipAddress} from conference", sipAddress); return(NoContent()); }
public async Task Should_remove_existing_endpoint() { var conference1 = new ConferenceBuilder() .WithEndpoint("Display1", "*****@*****.**").Build(); var seededConference = await TestDataManager.SeedConference(conference1); var sipAddress = conference1.Endpoints.First().SipAddress; TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; var command = new RemoveEndpointCommand(_newConferenceId, sipAddress); 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); } updatedConference.GetEndpoints().Should().BeEmpty(); }