public async Task Should_update_existing_endpoint_with_new_status()
        {
            var conference1 = new ConferenceBuilder()
                              .WithEndpoint("DisplayName", "*****@*****.**").Build();
            var seededConference = await TestDataManager.SeedConference(conference1);

            var endpointId             = conference1.Endpoints.First().Id;
            const EndpointState status = EndpointState.Connected;

            TestContext.WriteLine($"New seeded conference id: {seededConference.Id}");
            _newConferenceId = seededConference.Id;

            var command = new UpdateEndpointStatusCommand(_newConferenceId, endpointId, status);
            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);
            }
            var updatedEndpoint = updatedConference.GetEndpoints().Single(x => x.Id == endpointId);

            updatedEndpoint.State.Should().Be(status);
        }
        public void Should_throw_conference_not_found_exception_when_conference_does_not_exist()
        {
            var conferenceId           = Guid.NewGuid();
            var endpointId             = Guid.NewGuid();
            const EndpointState status = EndpointState.Connected;
            var command = new UpdateEndpointStatusCommand(conferenceId, endpointId, status);

            Assert.ThrowsAsync <ConferenceNotFoundException>(() => _handler.Handle(command));
        }
        public async Task Should_throw_exception_when_endpoint_does_not_exist()
        {
            var seededConference = await TestDataManager.SeedConference();

            var endpointId             = Guid.NewGuid();
            const EndpointState status = EndpointState.Connected;

            TestContext.WriteLine($"New seeded conference id: {seededConference.Id}");
            _newConferenceId = seededConference.Id;
            var command = new UpdateEndpointStatusCommand(_newConferenceId, endpointId, status);

            Assert.ThrowsAsync <EndpointNotFoundException>(async() => await _handler.Handle(command));
        }