Exemple #1
0
        public void 一二三四五集各買了一本_價格應為375()
        {
            //arrage
            var target = new ShoppingCart();

            var details = new List<CartDetail>()
            {
                new CartDetail(){
                ProductName = HarryPoter1,
                Amount = 1,
                Price = 100
                },
                new CartDetail(){
                ProductName = HarryPoter2,
                Amount = 1,
                Price = 100
                },
                new CartDetail(){
                ProductName = HarryPoter3,
                Amount = 1,
                Price = 100
                },
                new CartDetail(){
                ProductName = HarryPoter4,
                Amount = 1,
                Price = 100
                },
                new CartDetail(){
                ProductName = HarryPoter5,
                Amount = 1,
                Price = 100
                },
            };

            //act
            var expected = 375;
            var actual = target.CalcuatePrice(details);

            //assert
            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void 第一集買了一本_其他都沒買_價格應為100元()
        {
            //arrage
            var target = new ShoppingCart();
            var details = new List<CartDetail>()
            {
                new CartDetail(){
                ProductName = HarryPoter1,
                Amount = 1,
                Price = 100
                },
            };

            //act
            var expected = 100;
            var actual = target.CalcuatePrice(details);

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