コード例 #1
0
        public void 一二集各買了一本_第三集買了兩本_價格應為370元()
        {
            //arrange
            var target = new ShipperCart();
            var books = new List<Book>()
            {
                new Book(){Name="HarryPotter1",Amount=1,Price=100},
                new Book(){Name="HarryPotter2",Amount=1,Price=100},
                new Book(){Name="HarryPotter3",Amount=2,Price=100},
            };

            //act
            var expected = 370;
            var actual = target.CalcuateCartPrice(books);

            //assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void 第一集買了一本_其他都沒買_價格應為100元()
        {
            //arrange
            var target = new ShipperCart();
            var books = new List<Book>()
            {
                new Book(){Name="HarryPotter1",Amount=1,Price=100},
            };

            //act
            var expected = 100;
            var actual = target.CalcuateCartPrice(books);

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