protected override Task PublishStatusAsync(CallbackEvent callbackEvent) { var conferenceState = ConferenceState.Paused; var command = new UpdateConferenceStatusCommand(SourceConference.Id, conferenceState); return(CommandHandler.Handle(command)); }
public void Should_throw_exception_when_conference_does_not_exist() { var conferenceId = Guid.NewGuid(); var state = ConferenceState.Paused; var command = new UpdateConferenceStatusCommand(conferenceId, state); Assert.ThrowsAsync <ConferenceNotFoundException>(() => _handler.Handle(command)); }
public async Task Should_update_conference_status() { var seededConference = await TestDataManager.SeedConference(); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; const ConferenceState state = ConferenceState.Paused; var beforeState = seededConference.GetCurrentStatus(); var command = new UpdateConferenceStatusCommand(_newConferenceId, state); await _handler.Handle(command); var updatedConference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(_newConferenceId)); var afterState = updatedConference.GetCurrentStatus(); afterState.Should().NotBe(beforeState); afterState.Should().Be(state); }
protected override async Task PublishStatusAsync(CallbackEvent callbackEvent) { const ConferenceState conferenceState = ConferenceState.Suspended; var command = new UpdateConferenceStatusCommand(SourceConference.Id, conferenceState); await CommandHandler.Handle(command); var reason = "Hearing suspended"; if (SourceParticipant == null) { SourceParticipant = SourceConference.GetJudge(); reason = "Technical assistance"; } var taskCommand = new AddTaskCommand(SourceConference.Id, SourceParticipant.Id, reason, TaskType.Hearing); await CommandHandler.Handle(taskCommand); }
public async Task should_set_start_time_when_status_moves_from_not_started_to_in_session() { var conference = new ConferenceBuilder(true) .Build(); var seededConference = await TestDataManager.SeedConference(conference); TestContext.WriteLine($"New seeded conference id: {seededConference.Id}"); _newConferenceId = seededConference.Id; const ConferenceState state = ConferenceState.InSession; var beforeState = seededConference.GetCurrentStatus(); var command = new UpdateConferenceStatusCommand(_newConferenceId, state); await _handler.Handle(command); var updatedConference = await _conferenceByIdHandler.Handle(new GetConferenceByIdQuery(_newConferenceId)); var afterState = updatedConference.GetCurrentStatus(); afterState.Should().NotBe(beforeState); afterState.Should().Be(state); updatedConference.ActualStartTime.Should().HaveValue(); }