AddProduct() public method

Adds an item to the cart
public AddProduct ( Ucrm.Product product, int quantity ) : void
product Ucrm.Product The product type to be added to the cart
quantity int quantity of products to be added
return void
示例#1
0
        public void TestAddProduct()
        {
            var userId = Guid.NewGuid();
            Product p = new Product();
            Cart cart = new Cart(userId);

            cart.AddProduct(p, 10);

            Assert.AreEqual(10, cart.Items[p.Id]);
        }
示例#2
0
        public void TestSubmitOrder()
        {
            var userId = Guid.NewGuid();
            Product q = new Product();
            Cart cart = new Cart(userId);

            cart.AddProduct(q, 7);
            Order order = new Order(userId, cart.Items);
            Assert.AreEqual(7, order.Items[q.Id]);
        }