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