Example #1
0
        public async Task Change_Basket_Item_Quanity()
        {
            // Arrange
            _iRepositoryMock.Setup(m => m.GetAsync <BasketItem>(It.IsAny <Expression <Func <BasketItem, bool> > >(), null, null, null, null))
            .Returns(Task.FromResult(basketItemsDbSetMock));
            _iRepositoryMock.Setup(m => m.GetByIdAsync <BasketItem>(1)).Returns(Task.FromResult(basketItemDbSetMock));

            // Act
            var result = await _iBasketService.ChangeBasketItemQuantityAsync(1, 4);

            // Assert
            Assert.NotNull(result);
        }
Example #2
0
        public async Task <IActionResult> ChangeItemQuantity(int basketItemId, int quantity)
        {
            IList <BasketItem> basketItems = await _iBasketService.ChangeBasketItemQuantityAsync(basketItemId, quantity);

            if (basketItems == null)
            {
                return(NotFound("Item not found in the basket, please check the basketItemId"));
            }
            return(Ok(basketItems));
        }