Esempio n. 1
0
        public void ThrowsException_When_Price_Less_Than_Zero()
        {
            //Arrange
            IDiscountCalculator calc = GetDiscounter();

            //Act
            decimal finalPrice = calc.GetDiscountedValue(-10);
        }
Esempio n. 2
0
        public void Apply_Default_Discount_For_Amount_Of_100()
        {
            //Arrange
            IDiscountCalculator calc = GetDiscounter();

            //Act
            decimal finalPrice = calc.GetDiscountedValue(100);

            //Assert
            Assert.AreEqual(80, finalPrice);
        }
Esempio n. 3
0
        public decimal GetTotalValueOfProducts(IEnumerable <Product> products)
        {
            decimal price = products.Select(o => o.Price).DefaultIfEmpty(0).Sum(o => o);

            return(price = _disc.GetDiscountedValue(price));
        }