public async Task PutOrderItemReturns400WhenQuantityLessThan1()
        {
            OrderItem orderItem   = _fixture.Create <OrderItem>();
            Guid      orderItemId = Guid.NewGuid();
            int       quantity    = 0;

            _mockOrderItemAccess.Reset();
            _mockOrderItemAccess
            .Setup(a => a.UpdateOrderItemQuantityAsync(orderItemId, quantity, It.IsAny <CancellationToken>()))
            .ReturnsAsync(orderItem);
            OrderItemsController sut = CreateSystemUnderTest();

            var result = await sut.PutAsync(orderItemId, quantity, It.IsAny <CancellationToken>());

            _mockOrderItemAccess.Verify(a => a.UpdateOrderItemQuantityAsync(orderItemId, quantity, It.IsAny <CancellationToken>()), Times.Never);
            Assert.IsType <BadRequestResult>(result);
        }
        public async Task PutOrderItemReturns404WhenOrderItmNotFound()
        {
            OrderItem orderItem   = _fixture.Create <OrderItem>();
            Guid      orderItemId = Guid.NewGuid();
            int       quantity    = _fixture.Create <int>();

            _mockOrderItemAccess.Reset();
            _mockOrderItemAccess
            .Setup(a => a.UpdateOrderItemQuantityAsync(orderItemId, quantity, It.IsAny <CancellationToken>()))
            .ThrowsAsync(new OrderItemNotFoundException(string.Empty));
            OrderItemsController sut = CreateSystemUnderTest();

            var result = await sut.PutAsync(orderItemId, quantity, It.IsAny <CancellationToken>());

            _mockOrderItemAccess.Verify(a => a.UpdateOrderItemQuantityAsync(orderItemId, quantity, It.IsAny <CancellationToken>()), Times.Once);
            Assert.IsType <NotFoundResult>(result);
        }
        public async Task PutOrderItemReturnsOkayWhenOrderItemUpdated()
        {
            OrderItem orderItem   = _fixture.Create <OrderItem>();
            Guid      orderItemId = Guid.NewGuid();
            int       quantity    = _fixture.Create <int>();

            _mockOrderItemAccess.Reset();
            _mockOrderItemAccess
            .Setup(a => a.UpdateOrderItemQuantityAsync(orderItemId, quantity, It.IsAny <CancellationToken>()))
            .ReturnsAsync(orderItem);
            OrderItemsController sut = CreateSystemUnderTest();

            var result = await sut.PutAsync(orderItemId, quantity, It.IsAny <CancellationToken>());

            _mockOrderItemAccess.Verify(a => a.UpdateOrderItemQuantityAsync(orderItemId, quantity, It.IsAny <CancellationToken>()), Times.Once);
            Assert.IsType <OkObjectResult>(result);
            Assert.NotNull((OrderItem)((OkObjectResult)result).Value);
        }