public async Task Handle_ConferenceAlreadyOpen_NoExceptionAndDontPublishNotification() { const string conferenceId = "test"; // arrange SetConferenceIsOpen(conferenceId); InitializeConferenceInRepository(conferenceId); var handler = CreateHandler(); // act await handler.Handle(new OpenConferenceRequest(conferenceId), CancellationToken.None); // assert ConferenceManagementHelper.VerifyAnyFindConferenceById(_mediator); _mediator.VerifyNoOtherCalls(); }
public async Task Handle_ConferenceDoesNotExist_ThrowConferenceNotFoundException() { const string conferenceId = "test"; // arrange SetConferenceIsClosed(conferenceId); var handler = CreateHandler(); ConferenceManagementHelper.SetConferenceDoesNotExist(_mediator, conferenceId); // act & assert await Assert.ThrowsAsync <ConferenceNotFoundException>(async() => { await handler.Handle(new OpenConferenceRequest(conferenceId), CancellationToken.None); }); ConferenceManagementHelper.VerifyAnyFindConferenceById(_mediator); _mediator.VerifyNoOtherCalls(); _openConferenceRepository.VerifyNoOtherCalls(); }
private void InitializeConferenceInRepository(string conferenceId) { ConferenceManagementHelper.SetConferenceExists(_mediator, new Conference(conferenceId)); }