Esempio n. 1
0
        public async Task AddItemIntoBasket_ReturnsBasketItem()
        {
            // Arrange
            _iRepositoryMock.Setup(m => m.GetAsync <BasketItem>(It.IsAny <Expression <Func <BasketItem, bool> > >(), null, null, null, null)).Returns(Task.FromResult(basketItemsDbSetMock));

            // Act
            var result = await _iBasketService.AddItemintoBasketAsync(basketItemDbSetMock);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(6, result.Id);
        }
Esempio n. 2
0
        public async Task <IActionResult> Post([FromBody] BasketItem basketItem)
        {
            await _iBasketService.AddItemintoBasketAsync(basketItem);

            return(Created($"ShoppingCart", basketItem));
        }