public async void GivenCommandWhenTaskExistsThenAttachedSaveChangesCalled()
        {
            // Arrange
            var boardTaskEntry = new BoardTaskEntity
            {
                Id = 1
            };

            SetupCommandHandler(new List<BoardTaskEntity>
            {
                boardTaskEntry
            }, new List<BoardColumnEntity>
            {
                new BoardColumnEntity
                {
                    BoardEntity = new BoardEntity()
                }
            });

            var command = new UpdateBoardTaskCommand
            {
                BoardTask = new BoardTask
                {
                    Id = 1
                }
            };

            // Act
            await handler.HandleAsync(command);

            // Assert
            mockDataContext.Verify(x => x.SetModified(boardTaskEntry), Times.Once);
            mockDataContext.Verify(x => x.SaveChangesAsync(), Times.Once);
        }
        public async void GivenCommandWhenBoardAndBoardTaskExistThenBoardTaskRemovedAndSaveChangedCalled()
        {
            // Arrange
            var boardTaskEntity = new BoardTaskEntity { Id = 1 };
            SetupCommandHandler(new List<BoardEntity>
            {
                new BoardEntity {Slug = "board-name"}
            }, new List<BoardTaskEntity> { boardTaskEntity });

            var command = new DeleteBoardTaskCommand
            {
                BoardSlug = "board-name",
                BoardTaskId = 1
            };

            // Act
            await handler.HandleAsync(command);

            // Assert
            mockDataContext.Verify(x => x.SaveChangesAsync(), Times.Once());
            mockDataContext.Verify(x => x.Delete(boardTaskEntity), Times.Once());
        }
        public async void GivenCommandWhenTaskExistsButBoardColumnDoesNotThenThrowBoardColumnNotFoundException()
        {
            // Arrange
            var boardEntry = new BoardTaskEntity
            {
                Id = 1
            };

            SetupCommandHandler(new List<BoardTaskEntity>
            {
                boardEntry
            }, new List<BoardColumnEntity>());

            var command = new UpdateBoardTaskCommand
            {
                BoardTask = new BoardTask
                {
                    Id = 1
                }
            };

            // Act & Assert
            await Assert.ThrowsAsync<BoardColumnNotFoundException>(() => handler.HandleAsync(command));
        }
        public async void GivenCommandWhenTaskExistsThenMapDtoToEntity()
        {
            // Arrange
            var boardTaskEntity = new BoardTaskEntity
            {
                Id = 1
            };
            SetupCommandHandler(new List<BoardTaskEntity>
            {
                boardTaskEntity
            }, new List<BoardColumnEntity>
            {
                new BoardColumnEntity
                {
                    BoardEntity = new BoardEntity()
                }
            });
            var command = new UpdateBoardTaskCommand
            {
                BoardTask = new BoardTask
                {
                    Id = 1
                }
            };

            // Act
            await handler.HandleAsync(command);

            // Assert
            mockMappingService.Verify(x => x.Map(It.IsAny<BoardTask>(), It.IsAny<BoardTaskEntity>()), Times.Once);
        }