public void 一二三集各買了一本_價格應為270元()
        {
            //arrange
            var target = new PotterShoppingCart();

            //act
            target.AddToCart(
                new Book
            {
                ISBN  = "9573317249",
                Name  = "哈利波特1",
                Price = 100
            }
                );
            target.AddToCart(
                new Book
            {
                ISBN  = "9573317583",
                Name  = "哈利波特2",
                Price = 100
            }
                );
            target.AddToCart(
                new Book
            {
                ISBN  = "9573318008",
                Name  = "哈利波特3",
                Price = 100
            }
                );

            var totalPrice = target.CheckOut();

            //assert
            var expected = 270;

            Assert.AreEqual(expected, totalPrice);
        }
Example #2
0
        public void Buy_1_First_Vol_Cost_100()
        {
            //arrange
            var target           = new PotterShoppingCart();
            var shoppingCartItem = new PotterShoppingCartItem()
            {
                Volumn   = HarryPotter.VOL_1,
                Quantity = 1
            };
            var expectedCost = 100;

            //act
            int actualCost;

            target.AddToCart(shoppingCartItem);
            actualCost = target.CheckOut();

            //assert
            Assert.AreEqual(expectedCost, actualCost);
        }
        public void 第一集買了一本_價格應為100元()
        {
            //arrange
            var target = new PotterShoppingCart();
            var book   = new Book
            {
                ISBN  = "9789573317241",
                Name  = "哈利波特1",
                Price = 100
            };

            //act
            target.AddToCart(book);
            var totalPrice = target.CheckOut();

            //assert
            var expected = 100;

            Assert.AreEqual(expected, totalPrice);
        }