Esempio n. 1
0
        public void Discount_Negative_Total()
        {
            //arrange
            Discount.IDiscountHelper target = getTestObject();

            //act
            target.ApplyDiscount(-1);
        }
Esempio n. 2
0
        public void Discount_Above_100()
        {
            //arrange
            Discount.IDiscountHelper target = getTestObject();
            decimal total = 200;

            //act
            var discountedTotal = target.ApplyDiscount(total);

            //assert
            Assert.AreEqual(total * 0.9M, discountedTotal);
        }
Esempio n. 3
0
        public void Discount_Less_Than_10()
        {
            //arrange
            Discount.IDiscountHelper target = getTestObject();

            //act
            decimal discount5 = target.ApplyDiscount(5);
            decimal discount0 = target.ApplyDiscount(0);

            //assert
            Assert.AreEqual(5, discount5);
            Assert.AreEqual(0, discount0);
        }
Esempio n. 4
0
        public void Discount_Between_10_And_100()
        {
            //arrange
            Discount.IDiscountHelper target = getTestObject();

            //act
            decimal TenDollarDiscount     = target.ApplyDiscount(10);
            decimal HundredDollarDiscount = target.ApplyDiscount(100);
            decimal FiftyDollarDiscount   = target.ApplyDiscount(50);

            //assert
            Assert.AreEqual(5, TenDollarDiscount, "$10 discount is wrong");
            Assert.AreEqual(95, HundredDollarDiscount, "$100 discount is wrong");
            Assert.AreEqual(45, FiftyDollarDiscount, "$50 discount is wrong");
        }
Esempio n. 5
0
 public LinqValueCalculator(Discount.IDiscountHelper discountParam)
 {
     discounter = discountParam;
     System.Diagnostics.Debug.WriteLine(string.Format("Instance {0} created", ++counter));
 }