Ejemplo n.º 1
0
        public async Task Add_Product_To_Shopping_Cart_Should_Not_Be_Null()
        {
            // Arrange
            var product = new CartProductViewModel()
            {
                CartId    = 1,
                ProductId = 1,
            };

            _cartServiceMock.Setup(x => x.AddProductToCart(product)).Returns(Task.FromResult(product));

            // Act
            var result = await _shoppingCartController.AddProductToShoppingCart(product);

            // Assert
            var objectResult = result as OkObjectResult;

            Assert.NotNull(objectResult);

            var content = objectResult.Value as CartProductViewModel;

            Assert.NotNull(content);
        }