public void Handle_GivenInvalidId_ThrowsException() { var command = new DeletePaymentCommand { Id = 99 }; var sut = new DeletePaymentCommandHandler(_repository); Assert.ThrowsAsync <NotFoundException>(() => sut.Handle(command, CancellationToken.None)); }
public async Task Handle_GivenValidId_ShouldRemovePersistedPayment() { var command = new DeletePaymentCommand { Id = 1 }; var sut = new DeletePaymentCommandHandler(_repository); await sut.Handle(command, CancellationToken.None); var entity = await _repository.GetByIdAsync(command.Id).ConfigureAwait(false); entity.Should().BeNull(); }