Example #1
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);
        }
Example #2
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);
        }
Example #3
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);
        }
Example #4
0
    public static tshirt create(string _name, string _description,
        DateTime _expire_time, decimal _price, string _foto = "")
    {
        tshirt shirt = new tshirt {
            name = _name,
            description = _description,
            expire_time = _expire_time,
            price = _price,
            imagen = _foto
        };

        if (validateShirt(shirt))
        {
            db.tshirts.InsertOnSubmit(shirt);
            db.SubmitChanges();
            return shirt;
        }

        return null;
    }
Example #5
0
 private static bool validateShirt(tshirt shirt)
 {
     return shirt.expire_time > DateTime.Now;
 }
Example #6
0
 partial void Deletetshirt(tshirt instance);
Example #7
0
 partial void Updatetshirt(tshirt instance);
Example #8
0
 partial void Inserttshirt(tshirt instance);