コード例 #1
0
        public void Test_CalculateOneOffDiscount_Returns10_When21BooksInBasket()
        {
            //arrange
            Checkout checkout = new Checkout();
            Basket   basket   = new Basket();

            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());
            basket.AddBook(new Book());

            //act
            decimal actualDiscount = checkout.CalculateOneOffDiscount(basket.FindAllBooks());

            //assert
            Assert.That(actualDiscount, Is.EqualTo(10));
        }
コード例 #2
0
        public void Test_CalculateOneOffDiscount_Returns10_When11BooksInBasket()
        {
            //arrange
            Checkout checkout = new Checkout();
            Basket   basket   = new Basket();
            Book     book1    = new Book();
            Book     book2    = new Book();
            Book     book3    = new Book();
            Book     book4    = new Book();
            Book     book5    = new Book();
            Book     book6    = new Book();
            Book     book7    = new Book();
            Book     book8    = new Book();
            Book     book9    = new Book();
            Book     book10   = new Book();
            Book     book11   = new Book();

            basket.AddBook(book1);
            basket.AddBook(book2);
            basket.AddBook(book3);
            basket.AddBook(book4);
            basket.AddBook(book5);
            basket.AddBook(book6);
            basket.AddBook(book7);
            basket.AddBook(book8);
            basket.AddBook(book9);
            basket.AddBook(book10);
            basket.AddBook(book11);

            //act
            decimal actualDiscount = checkout.CalculateOneOffDiscount(basket.FindAllBooks());

            //assert
            Assert.That(actualDiscount, Is.EqualTo(10));
        }