Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
    }
Ejemplo n.º 5
0
 private static bool validateShirt(tshirt shirt)
 {
     return shirt.expire_time > DateTime.Now;
 }
Ejemplo n.º 6
0
 partial void Deletetshirt(tshirt instance);
Ejemplo n.º 7
0
 partial void Updatetshirt(tshirt instance);
Ejemplo n.º 8
0
 partial void Inserttshirt(tshirt instance);