Пример #1
0
        public void Discount_Above_100()
        {
            IDiscounterHelper target = getTestObject();
            decimal           total  = 200;

            var discountTotal = target.ApplyDiscount(total);

            Assert.AreEqual(total * 0.9m, discountTotal);
        }
Пример #2
0
        public void Discount_Less_Than_10()
        {
            IDiscounterHelper target = getTestObject();

            var five = target.ApplyDiscount(5);
            var zero = target.ApplyDiscount(0);

            Assert.AreEqual(5, five);
            Assert.AreEqual(0, zero);
        }
Пример #3
0
        public void Discount_Between_10_And_100()
        {
            IDiscounterHelper target = getTestObject();

            var ten     = target.ApplyDiscount(10);
            var hundred = target.ApplyDiscount(100);
            var fifty   = target.ApplyDiscount(50);

            Assert.AreEqual(5, ten, "rabat 10 jest nieprawdiłowy");
            Assert.AreEqual(95, hundred, "rabat 100 jest nieprawdiłowy");
            Assert.AreEqual(45, fifty, "rabat 50 jest nieprawdiłowy");
        }
 public LinqValueCalculator(IDiscounterHelper discounter)
 {
     _discounter = discounter;
     System.Diagnostics.Debug.WriteLine(string.Format("Utworzono egzemplarz {0}", ++counter));
 }
Пример #5
0
        public void Discount_Negative()
        {
            IDiscounterHelper target = getTestObject();

            target.ApplyDiscount(-1);
        }