Пример #1
0
        public void Should_throw_exception_when_conference_does_not_exist()
        {
            var conferenceId = Guid.NewGuid();
            var command      = new CloseConferenceCommand(conferenceId);

            Assert.ThrowsAsync <ConferenceNotFoundException>(() => _handler.Handle(command));
        }
        public async Task <IActionResult> CloseConferenceAsync(Guid conferenceId)
        {
            try
            {
                var command = new CloseConferenceCommand(conferenceId);

                await _commandHandler.Handle(command);
                await SafelyRemoveCourtRoomAsync(conferenceId);
                await DeleteAudioRecordingApplication(conferenceId);

                return(NoContent());
            }
            catch (ConferenceNotFoundException ex)
            {
                _logger.LogError(ex, "Unable to find conference {conferenceId}", conferenceId);

                return(NotFound());
            }
        }
Пример #3
0
        public async Task Should_update_conference_to_closed()
        {
            var beforeActionTime = DateTime.UtcNow;
            var seededConference = await TestDataManager.SeedConference();

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

            var beforeState = seededConference.GetCurrentStatus();

            var command = new CloseConferenceCommand(_newConferenceId);
            await _handler.Handle(command);

            var updatedConference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(_newConferenceId));

            var afterState = updatedConference.GetCurrentStatus();

            afterState.Should().NotBe(beforeState);
            afterState.Should().Be(ConferenceState.Closed);

            updatedConference.IsClosed().Should().BeTrue();
            updatedConference.ClosedDateTime.Should().BeAfter(beforeActionTime);
        }