Пример #1
0
        public async Task Handle_GivenInvalidPlannerId_ThrowsNotFoundException()
        {
            // Login user is creator
            var _sut = new DeletePlannerCommandHandler(_context, _mapper);

            var invalidPlannerId = Guid.NewGuid();

            var command = new DeletePlannerCommand {
                Id = invalidPlannerId
            };

            await Assert.ThrowsAsync <NotFoundException>(() => _sut.Handle(command, CancellationToken.None));
        }
Пример #2
0
        public async Task Handle_GivenValidPlannerId_DeleteSuccess()
        {
            // Login user is creator
            var _sut = new DeletePlannerCommandHandler(_context, _mapper);

            var command = new DeletePlannerCommand {
                Id = validPlannerId
            };

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

            var planner = await _context.TaskItems.FindAsync(validPlannerId);

            Assert.Null(planner);
        }