コード例 #1
0
        public void 一二三集各買了一本_價格應為270()
        {
            //Arrange
            var target = new HarryPotterCart();
            books.Add(new Book { Serial = "HarryPotter", Episode = 1, price = 100 });
            books.Add(new Book { Serial = "HarryPotter", Episode = 2, price = 100 });
            books.Add(new Book { Serial = "HarryPotter", Episode = 3, price = 100 });
            double expected = 270;

            //Act
            double actual = target.CountPrice(books);

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void 一二三集各買了一本_價格應為270()
        {
            //Arrange
            var books = new List<Book> {
                new Book { Serial = "HarryPotter", Episode = 1, price = 100 },
                new Book { Serial = "HarryPotter", Episode = 2, price = 100 },
                new Book { Serial = "HarryPotter", Episode = 3, price = 100 }
            };
            var target = new HarryPotterCart();
            var expected = 270;

            //Act
            var actual = target.CountPrice(books);

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