Exemple #1
0
        public void Then_The_Basket_Total_Is_Eight(BookTitle title, double expected)
        {
            var potterCalculator = new PotterCalculator();

            var actual = potterCalculator.Calculate(new List<BookTitle> {title});

            Assert.That(actual, Is.EqualTo(expected));
        }
Exemple #2
0
        public void Then_I_Get_5_Percent_Discount(BookTitle firstBookTitle, BookTitle secondBookTitle,
            BookTitle thirdBookTitle, BookTitle fourthBookTitle)
        {
            var potterCalculator = new PotterCalculator();
            var bookList = new List<BookTitle> {firstBookTitle, secondBookTitle, thirdBookTitle, fourthBookTitle};

            Assert.That(potterCalculator.Calculate(bookList), Is.EqualTo(25.6M));

            potterCalculator.Calculate(bookList)
                .Should()
                .Be(25.6M, "When you have four different books in you basket, you get 5% discount");
        }
Exemple #3
0
        public void Then_I_Get_Discounts_Accordingly()
        {
            var potterCalculator = new PotterCalculator();
            var bookList = new List<BookTitle> {BookTitle.TitleOne, BookTitle.TitleTwo,BookTitle.TitleThree, BookTitle.TitleOne, BookTitle.TitleTwo, BookTitle.TitleThree, BookTitle.TitleFour, BookTitle.TitleFive};

            potterCalculator.Calculate(bookList).Should().Be(54M);
        }
Exemple #4
0
        public void Then_I_Get_5_Percent_Discount(BookTitle firstBookTitle, BookTitle secondBookTitle,
            BookTitle thirdBookTitle)
        {
            var potterCalculator = new PotterCalculator();
            var bookList = new List<BookTitle> {firstBookTitle, secondBookTitle, thirdBookTitle};

            Assert.That(potterCalculator.Calculate(bookList), Is.EqualTo(23.2M));
            potterCalculator.Calculate(bookList)
                .Should()
                .Be(23.2M,
                    "When you have 2 same books in you basket and one different, you get 5% discount on two books and no discount on one book");
        }