Esempio n. 1
0
        Give_no_discount_when_book_is_not_eligible_for_a_discount()
        {
            var aBookWithNoDiscount = BookBuilder.ACookingBook().Costing(10.00).Build();
            var basket = BasketBuilder.ABasket().With(aBookWithNoDiscount).Build();

            Check.That(basket.PriceWithDiscount()).IsEqualTo(10.0);
            Check.That(basket.FullPrice()).IsEqualTo(10.0);
        }
Esempio n. 2
0
        Give_10_percent_discount_for_IT_books_when_containing_one_of_them()
        {
            var basket = BasketBuilder.ABasket()
                         .With(
                BookBuilder.AnITBook().Costing(10.0).Build())
                         .Build();

            Check.That(basket.PriceWithDiscount()).IsEqualTo(9.0);
        }
Esempio n. 3
0
        Give_30_percent_discount_for_IT_books_when_containing_multiple_books()
        {
            var basket = BasketBuilder.ABasket()
                         .With(
                BookBuilder.AnITBook().Costing(30.0).Build(),
                BookBuilder.AnITBook().Costing(10.0).Build(),
                BookBuilder.AnITBook().Costing(20.0).Build())
                         .Build();

            Check.That(basket.PriceWithDiscount()).IsEqualTo(42.0);
        }
Esempio n. 4
0
        Not_give_discount_for_Travel_books_when_containing_less_than_four_of_them()
        {
            var basket = BasketBuilder.ABasket()
                         .With(
                BookBuilder.ATravelBook().Costing(30.0).Build(),
                BookBuilder.ATravelBook().Costing(10.0).Build(),
                BookBuilder.ATravelBook().Costing(20.0).Build())
                         .Build();

            Check.That(basket.FullPrice()).IsEqualTo(60.0);
        }
Esempio n. 5
0
        Give_40_percent_discount_for_Travel_books_when_containing_more_than_three_of_them()
        {
            var basket = BasketBuilder.ABasket()
                         .With(
                BookBuilder.ATravelBook().Costing(30.0).Build(),
                BookBuilder.ATravelBook().Costing(10.0).Build(),
                BookBuilder.ATravelBook().Costing(20.0).Build(),
                BookBuilder.ATravelBook().Costing(10.0).Build())
                         .Build();

            Check.That(basket.PriceWithDiscount()).IsEqualTo(42.0);
        }
Esempio n. 6
0
        Calculate_the_total_price_with_no_discount_when_containing_multiple_books()
        {
            var basket = BasketBuilder.ABasket()
                         .With(
                BookBuilder.ACookingBook().Costing(10.0).Build(),
                BookBuilder.AnITBook().Costing(30.0).Build(),
                BookBuilder.AnITBook().Costing(20.0).Build(),
                BookBuilder.ATravelBook().Costing(20.0).Build())
                         .Build();

            Check.That(basket.FullPrice()).IsEqualTo(80.0);
        }
Esempio n. 7
0
        Combine_10_percent_discount_for_1_IT_book_and_40_percent_discount_for_4_Travel_books()
        {
            var basket = BasketBuilder.ABasket()
                         .With(
                BookBuilder.AnITBook().Costing(10.0).Build(),
                BookBuilder.ATravelBook().Costing(30.0).Build(),
                BookBuilder.ATravelBook().Costing(10.0).Build(),
                BookBuilder.ATravelBook().Costing(20.0).Build(),
                BookBuilder.ATravelBook().Costing(10.0).Build())
                         .Build();

            Check.That(basket.PriceWithDiscount()).IsEqualTo(51.0);
        }
Esempio n. 8
0
 Return_an_unmodifiable_list_of_books()
 {
     BasketBuilder.ABasket().Build().Books().Add(BookBuilder.ACookingBook().Build());
 }