public async Task Handle_GivenInvalidTaskId_ShouldRaiseException() { /// Arrange var sut = new PinTaskItemCommandHandler(_context, _mapper); var command = new PinTaskItemCommand { Id = Guid.NewGuid(), IsPin = true }; /// Act await Assert.ThrowsAsync <NotFoundException>(() => sut.Handle(command, CancellationToken.None)); }
public async Task Handle_GivenValidTaskId_ShouldUpdateTaskItem() { /// Arrange var sut = new PinTaskItemCommandHandler(_context, _mapper); var command = new PinTaskItemCommand { Id = validUnpinTaskItemId, IsPin = true }; var result = await sut.Handle(command, CancellationToken.None); /// Assert result.IsPin.ShouldBe(true); }