Example #1
0
        public async Task Handle_InvalidId_ThrowsException()
        {
            var command = new DeleteBidItemCommand
            {
                BidListId = 22
            };

            var handler = new DeleteBidItemCommand.DeleteBidItemCommandHandler(dbContext);

            await Assert.ThrowsAsync <NotFoundException>(() =>
                                                         handler.Handle(command, CancellationToken.None));
        }
Example #2
0
        public async Task Handle_ValidId_ShouldRemovePersistedBidItem()
        {
            var command = new DeleteBidItemCommand
            {
                BidListId = 1
            };

            var handler = new DeleteBidItemCommand.DeleteBidItemCommandHandler(dbContext);

            await handler.Handle(command, CancellationToken.None);

            var entity = dbContext.BidList.Find(command.BidListId);

            Assert.Null(entity);
        }