Beispiel #1
0
        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));
        }
Beispiel #2
0
        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);
        }