コード例 #1
0
        private void CheckFinishedcoupon(object source, ElapsedEventArgs e)
        {
            LinkedList <Coupon> CouponToRemove = new LinkedList <Coupon>();

            foreach (Coupon c in coupons)
            {
                if (DateTime.Now.CompareTo(DateTime.Parse(c.DueDate)) > 0)
                {
                    CouponToRemove.AddLast(c);
                }
            }
            foreach (Coupon c in CouponToRemove)
            {
                CDB.Remove(c);
                coupons.Remove(c);
            }
        }
コード例 #2
0
 public void RemoveCoupon()
 {
     try
     {
         Coupon toRemove = new Coupon("hey", 1, 50, "02/02/2020");
         couponDB.Remove(toRemove);
         li = couponDB.Get();
         Assert.AreEqual(li.Count, 0);
     }
     catch (Exception e)
     { Assert.AreEqual(true, false, "there was a connection error to the testing db"); }
 }