public void CartService_TransformCart_WorkCorrect()
        {
            var cart = new Cart
            {
                Items = new List <CartItem>
                {
                    new CartItem {
                        ProductId = 1, Quantity = 1
                    },
                    new CartItem {
                        ProductId = 2, Quantity = 5
                    }
                }
            };
            int expected_count_item = 10;
            var products            = new PagedProductDTO
            {
                Products = Enumerable.Range(0, expected_count_item)
                           .Select(i => new ProductDTO
                {
                    Id       = i,
                    Name     = $"Product {i}",
                    Price    = 100m,
                    Order    = 0,
                    ImageUrl = $"Product{i}.png",
                    Brand    = new BrandDTO {
                        Id = 1, Name = "BrandName"
                    },
                    Category = new CategoryDTO {
                        Id = 1, Name = "CategoryName"
                    }
                }),
                TotalCount = expected_count_item
            };


            var product_data_mock = new Mock <IProductService>();

            product_data_mock
            .Setup(c => c.GetProducts(It.IsAny <ProductFilter>()))
            .Returns(products);

            var cart_store_mock = new Mock <ICartStore>();

            cart_store_mock
            .Setup(c => c.Cart)
            .Returns(cart);

            var cart_service = new CookieCartService(product_data_mock.Object, cart_store_mock.Object);

            var result = cart_service.TransformCart();

            Assert.Equal(6, result.ItemsCount);
            Assert.Equal(100m, result.Items.First().Key.Price);
        }
        public void CartService_TransformCart_WorksCorrect()
        {
            var cart = new Cart
            {
                Items = new List <CartItem> {
                    new CartItem {
                        ProductId = 1, Quantity = 4
                    }
                }
            };

            var products = new PagedProductDto
            {
                Products = new List <ProductDto>
                {
                    new ProductDto
                    {
                        Id       = 1,
                        ImageUrl = "image.jpg",
                        Name     = "Test",
                        Order    = 0,
                        Price    = 1.11m,
                    }
                },
                TotalCount = 1
            };

            var product_data_mock = new Mock <IProductData>();

            product_data_mock.Setup(c => c.GetProducts(It.IsAny <ProductFilter>())).Returns(products);

            var cart_store_mock = new Mock <ICartStore>();

            cart_store_mock.Setup(c => c.Cart).Returns(cart);

            var cart_service = new CookieCartService(product_data_mock.Object, cart_store_mock.Object);

            var result = cart_service.TransformCart();

            Assert.Equal(4, result.ItemsCount);
            Assert.Equal(1.11m, result.Items.First().Key.Price);
        }