Пример #1
0
        public void OneCopyOfAnyOfTheFiveBooksCosts8Eur(string book)
        {
            PotterBasket basket = SetupBasket();

            basket.Add(book);

            Assert.AreEqual(8M, basket.Total);
        }
Пример #2
0
        public void IfYouBuyTwoDifferentBooksYouGetA5PercentDiscountOnThoseTwoBooks(string book1, string book2)
        {
            PotterBasket basket = SetupBasket();

            basket.Add(book1);
            basket.Add(book2);

            Assert.AreEqual(8M * 2 * 0.95M, basket.Total);
        }
Пример #3
0
        public void TwoCopiesOfTheSameBookCosts16Eur(string book)
        {
            PotterBasket basket = SetupBasket();

            basket.Add(book);
            basket.Add(book);

            Assert.AreEqual(16M, basket.Total);
        }
Пример #4
0
        public void IfYouBuyThreeDifferentBooksYouGetA10PercentDiscountOnThoseThreeBooks(string book1, string book2,
                                                                                         string book3)
        {
            PotterBasket basket = SetupBasket();

            basket.Add(book1);
            basket.Add(book2);
            basket.Add(book3);

            Assert.AreEqual(8M * 3 * 0.9M, basket.Total);
        }
Пример #5
0
        public void With4DifferentBooksYouGetA20PercentDiscount(string book1, string book2, string book3, string book4)
        {
            PotterBasket basket = SetupBasket();

            basket.Add(book1);
            basket.Add(book2);
            basket.Add(book3);
            basket.Add(book4);

            Assert.AreEqual(8M * 4 * 0.8M, basket.Total);
        }
Пример #6
0
        public void IfYouBuyAll5YouGetAHuge25PercentDiscount(string book1, string book2, string book3, string book4,
                                                             string book5)
        {
            PotterBasket basket = SetupBasket();

            basket.Add(book1);
            basket.Add(book2);
            basket.Add(book3);
            basket.Add(book4);
            basket.Add(book5);

            Assert.AreEqual(8M * 5 * 0.75M, basket.Total);
        }
Пример #7
0
        public void HowMuchDoesThisBasketOfBooksCost()
        {
            PotterBasket basket = SetupBasket();

            basket.Add("Harry Potter and the Philosopher's Stone");
            basket.Add("Harry Potter and the Philosopher's Stone");
            basket.Add("Harry Potter and the Chamber of Secrets");
            basket.Add("Harry Potter and the Chamber of Secrets");
            basket.Add("Harry Potter and the Prisoner of Azkaban");
            basket.Add("Harry Potter and the Prisoner of Azkaban");
            basket.Add("Harry Potter and the Goblet of Fire");
            basket.Add("Harry Potter and the Order of the Phoenix");

            Assert.AreEqual(51.20M, basket.Total);
        }
Пример #8
0
 protected void SetUp()
 {
     _potterBasket = new PotterBasket();
 }
Пример #9
0
        private PotterBasket SetupBasket()
        {
            var basket = new PotterBasket();

            return(basket);
        }