Пример #1
0
        public void DeactivateCoupon()
        {
            string s = Factories.GetMockCouponCode();
            Coupon c = new Coupon(s, Factories.GetMockCouponName(), new Dictionary<string, int>());
            c.DiscountInCents.Add("USD", 100);
            c.DiscountInCents.Add("EUR", 50);

            c.Create();

            Assert.IsNotNull(c.CreatedAt);

            c.Deactivate();

            c = Coupon.Get(s);
            Assert.IsNotNull(s);
            Assert.AreEqual(c.State, Coupon.CouponState.inactive);
        }
Пример #2
0
        public void ListCouponsRedeemable()
        {
            string s = Factories.GetMockCouponCode();
            Coupon c = new Coupon(s, Factories.GetMockCouponName(), 1);
            c.Create();
            c.Deactivate();
            Thread.Sleep(1000);
            s = Factories.GetMockCouponCode();
            c = new Coupon(s, Factories.GetMockCouponName(), 2);
            c.Create();

            CouponList list = CouponList.List(Coupon.CouponState.redeemable);
            Assert.IsTrue(list.Count > 1);
        }