Beispiel #1
0
 public void TestThatDiscountInitializes()
 {
     var target = new Discount(0.01, 1);
     Assert.IsNotNull(target);
     Assert.AreEqual(0.01, target.ReductionPercent);
     Assert.AreEqual(1, target.FrequentFlyerMilesCost);
 }
        public void TestThatServiceLocatorAvailableDiscountsReturnsExpectedDiscounts()
        {
            var firstDiscount = new Discount(0.05, 1000);
            var secondDisctount = new Discount(0.10, 1750);
            var locator = new ServiceLocator();

            locator.AddDiscount(firstDiscount);
            locator.AddDiscount(secondDisctount);

            Assert.AreSame(firstDiscount, locator.AvailableDiscounts[0]);
            Assert.AreSame(secondDisctount, locator.AvailableDiscounts[1]);
            Assert.AreEqual(2, locator.AvailableDiscounts.Count);
        }
 public void AddDiscount(Discount aDiscount)
 {
     discounts.Add(aDiscount);
 }