Esempio n. 1
0
        public void PassBatchInitializationTest()
        {
            try
            {
                var start = DateTime.Today;
                var end   = DateTime.Today.AddDays(1);
                var id    = Guid.NewGuid();
                var calc  = new BogoDiscountCalculator(0, 0);

                var batchPromo = new BatchPromotion(start, end, id, "Test", calc);

                Assert.IsNotNull(batchPromo);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Esempio n. 2
0
        public void PassBatchBogoDiscountTest()
        {
            try
            {
                var start = DateTime.Today;
                var end   = DateTime.Today.AddDays(1);
                var id    = Guid.NewGuid();
                var calc  = new BogoDiscountCalculator(1, 0.5M);

                var batchPromo = new BatchPromotion(start, end, id, "Test", calc);
                var actual     = batchPromo.CalculateBatchPrice(10, 2);

                Assert.AreEqual(15, actual);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }