public void TestRemoveVisit() { using (basicEntities be = new basicEntities()) { visit = new Visit(); visit.Id = 1; visit.Date = "01/01/2004"; Location l = new Location(); l.Longitude = 34.791462; l.Latitude = 31.252973; visit.Location = l; ((Customer)customer).Visits.Add(visit); be.Users.Add(customer); be.Visits.Add(visit); be.SaveChanges(); be.Visits.Remove(be.Visits.Find(visit.Id)); be.Users.Remove(be.Users.Find("customer")); be.Locations.Remove(be.Locations.Find(l.Id)); be.SaveChanges(); Assert.IsNull(be.Visits.Find(visit.Id)); } }
public void TestRemoveRecommendation() { using (basicEntities be = new basicEntities()) { customer = TestCustomer.AddCustomer("Customer123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); rec = new Recommendation(); rec.Description = "blabla"; rec.Id = 4; rec.Link = "www.google.com"; rec.Source = SourceType.GooglePlus; rec.Customer = customer; be.Users.Add(customer); be.Recommendations.Add(rec); be.SaveChanges(); be.Recommendations.Remove(rec); be.Users.Remove(be.Users.Find(customer.UserName)); be.SaveChanges(); Assert.IsNull(be.Recommendations.Find(rec.Id)); } }
public void TestRemoveCustomerInterests() { using (basicEntities be = new basicEntities()) { customer = TestCustomer.AddCustomer("Customer123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); be.Users.Add(customer); be.SaveChanges(); ci = new CustomerIntrests(); ci.InterestID = InterestType.Dancing; ci.CustomerUserName = customer.UserName; be.CustomerIntrests.Add(ci); be.SaveChanges(); CustomerIntrests c = be.CustomerIntrests.Find(ci.CustomerUserName, ci.InterestID); if (c != null) { be.CustomerIntrests.Remove(c); be.Users.Remove(be.Users.Find(customer.UserName)); be.SaveChanges(); } } }
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 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 TestAddCoupon() { coupon = TestCouponAdd(); using (basicEntities be = new basicEntities()) { Assert.AreEqual(be.Coupons.Find(coupon).Id, coupon); } }
public void TestAddBusiness() { using (basicEntities be = new basicEntities()) { Businessid = TestBusinessAdd(); Assert.AreEqual(be.Businesses.Find(Businessid).BusinessID, Businessid); } }
public bool IsEmailExist(string email) { using (basicEntities db = new basicEntities()) { var v = db.tblUsers.Where(a => a.Email == email).FirstOrDefault(); return(v != null); } }
public void TestRemoveBusiness() { Businessid = TestBusinessAdd(); using (basicEntities be = new basicEntities()) { RemoveBusinesses(Businessid); Assert.AreEqual(be.Businesses.Find(Businessid), null); } }
public void TestRemoveCoupon() { coupon = TestCouponAdd(); using (basicEntities be = new basicEntities()) { RemoveCoupon(coupon); Assert.AreEqual(be.Coupons.Find(coupon), null); } }
public void TestAddAdmin() { using (basicEntities be = new basicEntities()) { string username = TestAdminAdd(); Assert.AreEqual(be.Users.Find(username).UserName, username); RemoveAdmin(username); } }
public void TestAddCustomer() { using (basicEntities be = new basicEntities()) { string username = TestCustomerAdd(); Assert.AreEqual(be.Users.Find(username).UserName, username); RemoveCustomer(username); } }
public static void RemoveUser(string user) { using (basicEntities be = new basicEntities()) { User userToRemove = be.Users.Find(user); be.Users.Remove(userToRemove); be.SaveChanges(); } }
public static string TestOwnerAdd() { using (basicEntities be = new basicEntities()) { Owner o = AddOwner("owner123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); be.Users.Add(o); be.SaveChanges(); return(o.UserName); } }
public void TestRemoveCustomer() { string username = TestCustomerAdd(); using (basicEntities be = new basicEntities()) { RemoveCustomer(username); Assert.AreEqual(be.Users.Find(username), null); } }
public static void RemoveAdmin(string admin) { using (basicEntities be = new basicEntities()) { User AdminToRemove = be.Users.Find(admin); be.Users.Remove(AdminToRemove); be.SaveChanges(); } }
public static string TestUserAdd() { using (basicEntities be = new basicEntities()) { User u = AddUser("User123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); be.Users.Add(u); be.SaveChanges(); return(u.UserName); } }
public static string TestAdminAdd() { using (basicEntities be = new basicEntities()) { Admin A = AddAdmin("Admin123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); be.Users.Add(A); be.SaveChanges(); return(A.UserName); } }
public void Cleanup() { using (basicEntities be = new basicEntities()) { if (be.Locations.Find(loc.Id) != null) { be.Locations.Remove(be.Locations.Find(loc.Id)); be.SaveChanges(); } } }
public string TestCustomerAdd() { using (basicEntities be = new basicEntities()) { Customer c = AddCustomer("Customer123", "adam", "admin123123", 054, 3134195, "*****@*****.**"); be.Users.Add(c); be.SaveChanges(); return(c.UserName); } }
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 void TestUpdateBusiness() { using (basicEntities be = new basicEntities()) { Businessid = TestBusinessAdd(); be.Businesses.Find(Businessid).Address = "tel ron"; be.SaveChanges(); Assert.AreEqual(be.Businesses.Find(Businessid).Address, "tel ron"); } }
public void Cleanup() { using (basicEntities be = new basicEntities()) { if (be.Coupons.Find(coupon) != null) { be.Coupons.Remove(be.Coupons.Find(coupon)); be.SaveChanges(); TestBusiness.RemoveBusinesses(Businessid); be.SaveChanges(); } } }
public void Cleanup() { using (basicEntities be = new basicEntities()) { if (be.Businesses.Find(Businessid) != null) { be.Businesses.Remove(be.Businesses.Find(Businessid)); be.SaveChanges(); TestOwner.RemoveOwner(owners); TestAdmin.RemoveAdmin(admins); } } }
public void TestUpdateUser() { using (basicEntities be = new basicEntities()) { string username = TestUserAdd(); be.Users.Find(username).Name = "sos"; be.SaveChanges(); Assert.AreEqual(be.Users.Find(username).Name, "sos"); RemoveUser(username); } }
public static void DeleteAllUser() { using (basicEntities be = new basicEntities()) { var query = from b in be.Users select b; foreach (Coupon.User item in query) { TestUser.RemoveUser(item.UserName); } } }
public static void DeleteAllBusiness() { using (basicEntities be = new basicEntities()) { var query = from b in be.Businesses select b; foreach (Coupon.Business item in query) { TestBusiness.RemoveBusinesses(item.BusinessID); } } }
public void Cleanup() { using (basicEntities be = new basicEntities()) { if (be.Visits.Find(visit.Id) != null) { be.Visits.Remove(be.Visits.Find(visit.Id)); be.Users.Remove(be.Users.Find("customer")); be.Locations.Remove(be.Locations.Find(l.Id)); be.SaveChanges(); } } }
public static void DeleteAllCoupons() { using (basicEntities be = new basicEntities()) { var query = from b in be.Coupons select b; foreach (Coupon.Coupon item in query) { TestCoupon.RemoveCoupon(item.Id); } } }
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); } }