public void TestAddOrderedCoupon() { using (basicEntities be = new basicEntities()) { owner = TestOwner.AddOwner("owner123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); admin = TestAdmin.AddAdmin("admin123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); b = TestBusiness.AddBusinesses("123", admin, owner, "beer-Sheva", "bla", Category.CarsAccessories); cop = TestCoupon.CreateCoupon(2, "Fly PIZZA", "100", "40", b, "10/10/2014", 8); customer = TestCustomer.AddCustomer("Customer123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); be.Users.Add(owner); be.Users.Add(admin); be.Businesses.Add(b); be.Coupons.Add(cop); be.SaveChanges(); oc = new OrderedCoupon(); oc.SerialNum = 4; oc.Status = StatusType.NotUsed; oc.PurchaseDate = "27/04/1990"; oc.Coupon = cop; oc.UseDate = ""; oc.Rank = "0"; oc.Opinion = ""; oc.Customer = customer; be.OrderedCoupons.Add(oc); be.SaveChanges(); Assert.AreEqual(be.OrderedCoupons.Find(oc.SerialNum).PurchaseDate, oc.PurchaseDate); } }
public void TestAddCouponInterests() { using (basicEntities be = new basicEntities()) { owner = TestOwner.AddOwner("owner123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); admin = TestAdmin.AddAdmin("admin123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); b = TestBusiness.AddBusinesses("123", admin, owner, "beer-Sheva", "bla", Category.CarsAccessories); cop = TestCoupon.CreateCoupon(2, "Fly PIZZA", "100", "40", b, "10/10/2014", 8); be.Users.Add(owner); be.Users.Add(admin); be.Businesses.Add(b); be.Coupons.Add(cop); be.SaveChanges(); ci = new CouponInterests(); ci.CouponId = cop.Id; ci.InterestID = InterestType.Dancing; be.CouponInterests.Add(ci); be.SaveChanges(); Assert.AreEqual(be.CouponInterests.Find(ci.InterestID, ci.CouponId).CouponId, ci.CouponId); } }
public static void RemoveCoupon(int CouponID) { using (basicEntities be = new basicEntities()) { Coupon.Coupon CouponToRemove = be.Coupons.Find(CouponID); string Businessid = CouponToRemove.Business.BusinessID; be.Coupons.Remove(CouponToRemove); be.SaveChanges(); TestBusiness.RemoveBusinesses(Businessid); be.SaveChanges(); } }
public static Coupon.Coupon CreateCoupon(int id, string name, string orgprice, string discount, Business b, string datee, int maxNum) { Coupon.Coupon cop = new Coupon.Coupon(); cop.Id = id; cop.Name = name; cop.OriginalPrice = orgprice; cop.DiscountPrice = discount; cop.Business = b; cop.ExperationDate = datee; cop.MaxNum = maxNum; cop.RankCount = 0; return(cop); }
[TestMethod] // edit test public void test_EditCoupon() { db.CouponSet.Add(a); Coupon.Coupon tmp = db.CouponSet.Find(a.Name); db.CouponSet.Remove(a); db.SaveChanges(); tmp.Name = "THE boris SHOW"; db.CouponSet.Add(tmp); db.SaveChanges(); Assert.AreEqual(db.CouponSet.Find(a.Name).Name, "THE boris SHOW"); db.CouponSet.Remove(tmp); db.SaveChanges(); }
[TestMethod] // edit test public void test_EditSocialCoupon() { db.CouponSet.Add(a); Coupon.Coupon tmp = db.CouponSet.Find(a.Name); db.CouponSet.Remove(a); db.SaveChanges(); tmp.Name = "other name"; db.CouponSet.Add(tmp); db.SaveChanges(); Assert.AreEqual(db.CouponSet.Find(a.Name).Name, "other name"); db.CouponSet.Remove(tmp); db.SaveChanges(); }
public int TestCouponAdd() { TestBusiness bn = new TestBusiness(); Businessid = bn.TestBusinessAdd(); using (basicEntities be = new basicEntities()) { Business b = be.Businesses.Find(Businessid); Coupon.Coupon cop = CreateCoupon(2, "Fly PIZZA", "100", "40", b, "10/10/2014", 8); be.Coupons.Add(cop); be.SaveChanges(); return(cop.Id); } }
public void intilaizeTest() { a = new Coupon.Coupon(); a.Name = "THE GALIA SHOW"; a.CouponCode = 90; a.Description = "clubs"; a.Category = CategoryType.HealthandBeauty; b = new Coupon.Coupon(); b.Name = "THE DROR SAIL"; b.CouponCode = 80; b.Description = "boats"; b.Category = CategoryType.Sports; }
public void intilaizeTest() { a = new Coupon.Coupon(); a.Name = "Domina"; a.CouponCode = 90; a.Description = "Zoo"; a.Category = CategoryType.Shopping; b = new Coupon.Coupon(); b.Name = "Pizza Dominos"; b.CouponCode = 80; b.Description = "food and more"; b.Category = CategoryType.Food; }