public async Task GivenWhiteSpaceId_WhenDelete_ThenQuerySent_AndResponseReturned()
        {
            // Arrange
            var mockMediator = new Mock <IMediator>();
            var sut          = new PrintersController(
                new PrinterIdValidator(),
                mockMediator.Object);
            var response = new DeletePrinterByIdCommandResponse();

            mockMediator.Setup(x => x.Send(
                                   It.IsAny <DeletePrinterByIdCommand>(),
                                   It.IsAny <CancellationToken>()))
            .ReturnsAsync(response);

            var cancellationTokenSource = new CancellationTokenSource();

            // Act
            var result = await sut.Delete(
                " ",
                cancellationTokenSource.Token);

            // Assert
            Assert.False(result.Success);
            Assert.Equal(HttpStatusCode.BadRequest, result.Error.HttpStatusCode);
        }
        public async Task GivenId_WhenDelete_ThenQuerySent_AndResponseReturned()
        {
            // Arrange
            var mockMediator = new Mock <IMediator>();
            var sut          = new PrintersController(
                new PrinterIdValidator(),
                mockMediator.Object);
            var id       = ObjectId.GenerateNewId().ToString();
            var response = new DeletePrinterByIdCommandResponse();

            mockMediator.Setup(x => x.Send(
                                   It.IsAny <DeletePrinterByIdCommand>(),
                                   It.IsAny <CancellationToken>()))
            .ReturnsAsync(response);

            var cancellationTokenSource = new CancellationTokenSource();

            // Act
            var result = await sut.Delete(
                id,
                cancellationTokenSource.Token);

            // Assert
            mockMediator.Verify(x => x.Send(
                                    It.Is <DeletePrinterByIdCommand>(y => y.Id == id),
                                    It.Is <CancellationToken>(y => y == cancellationTokenSource.Token)), Times.Once);
            Assert.Null(result.Error);
        }
        public void Delete_Returns_HttpBadRequestWhenIdIsNull()
        {
            ActionResult result = _uut.Delete(null);

            Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult));
        }