示例#1
0
        public void Buy7Jeansfor5()
        {
            ShoppingCart sc = new ShoppingCart();

            Product jean = new Jean(20);

            sc.Add(jean, 7);

            double totalPrice = sc.TotalValue();

            Assert.AreEqual(100, totalPrice);
        }
示例#2
0
        public string GetPants(int id, int weight, int stock, int inseam, int size)
        {
            Jean jean = new Jean
            {
                ID        = id,
                Weight    = weight,
                Stock     = stock,
                Inseam    = inseam,
                WaistSize = size
            };

            return(jean.GetFeatures());
        }
示例#3
0
        public void InitShoppingCart()
        {
            ShoppingCart sc = new ShoppingCart();

            Product productA = new tshirt(10);
            Product productB = new Jean(20);

            sc.Add(productA);
            sc.Add(productB);


            Assert.AreEqual(2, sc.Products.Count);
        }
示例#4
0
        public void Buy2Jeans2Tshirt()
        {
            ShoppingCart sc = new ShoppingCart();

            Product jean   = new Jean(20);
            Product tshirt = new tshirt(10);

            sc.Add(jean, 2);
            sc.Add(tshirt, 2);

            double totalPrice = sc.TotalValue();

            Assert.AreEqual(45, totalPrice);
        }
示例#5
0
        public void Sc1AddTshirtAndJean()
        {
            ShoppingCart sc = new ShoppingCart();

            Product tshirt = new tshirt(10);
            Product jean   = new Jean(20);

            sc.Add(tshirt);
            sc.Add(jean);

            double totalPrice = sc.TotalValue();

            Assert.AreEqual(30, totalPrice);
        }