Ejemplo n.º 1
0
        public void Handle_GivenInvalidId_ThrowsException()
        {
            var command = new DeletePaymentCommand
            {
                Id = 99
            };

            var sut = new DeletePaymentCommandHandler(_repository);

            Assert.ThrowsAsync <NotFoundException>(() =>
                                                   sut.Handle(command, CancellationToken.None));
        }
Ejemplo n.º 2
0
        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();
        }