Exemplo n.º 1
0
        public void ShoppingCart_buy_5_books_with_3_different()
        {
            //arrange
            ShoppingCart      target = new ShoppingCart();
            List <PotterBook> books  = new List <PotterBook>
            {
                new PotterBook {
                    Episode = 1
                },
                new PotterBook {
                    Episode = 2
                },
                new PotterBook {
                    Episode = 2
                },
                new PotterBook {
                    Episode = 3
                },
                new PotterBook {
                    Episode = 3
                },
            };

            target.AddToCart(books);
            var expected = 460;

            //act
            var actual = target.Billing();

            //assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void ShoppingCart_buy_1_book()
        {
            //arrange
            ShoppingCart target = new ShoppingCart();
            PotterBook   book   = new PotterBook {
                Episode = 1
            };

            target.AddToCart(book);
            var expected = 100;

            //act
            var actual = target.Billing();

            //assert
            Assert.AreEqual(expected, actual);
        }