Exemple #1
0
        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);
            }
        }