public void When_Calculating_The_Price_Of_An_Empty_Cart_Price_Should_Be_Zero()
        {
            var cart = new Cart();
              var discounter = MockRepository.GenerateStub<IDiscounter>();
              discounter.Expect(x => x.ApplyDiscounts(null)).IgnoreArguments().Return(cart.Books);
              var item = new PriceCalculator(discounter);

              int expected = 0;
              decimal actual = item.CalculatePriceFor(cart);

              actual.ShouldEqual(expected);
        }
        public void When_Calculating_The_Price_Of_Two_Books_Price_Should_Be_The_Sum_Of_Books_Price()
        {
            var cart = new Cart();
              var discounter = MockRepository.GenerateStub<IDiscounter>();
              discounter.Expect(x => x.ApplyDiscounts(null)).IgnoreArguments().Return(cart.Books);
              var item = new PriceCalculator(discounter);
              int expected = 20;

              cart.AddBook(new Book("", 10));
              cart.AddBook(new Book("", 10));
              decimal actual = item.CalculatePriceFor(cart);

              actual.ShouldEqual(expected);
        }
 public decimal CalculatePriceFor(Cart cart)
 {
     IList<Book> discountedBooks = ApplyDiscounts(cart.Books);
       return discountedBooks.Sum(x => x.Price);
 }