Beispiel #1
0
 public void 第1集買了_1_本_第2集買了_1_本_價格應為_190元()
 {
     //arrange
     var cart = new Cart();
     cart.AddBook(new Book() { bookName = "哈利波特第1集" });
     cart.AddBook(new Book() { bookName = "哈利波特第2集" });
     var expected = 190;
     //act
     var actual = cart.CalPrice();
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #2
0
 public void 一二集各買了1本_第三集買了2本_價格應為_370元()
 {
     //arrange
     var cart = new Cart();
     cart.AddBook(new Book() { bookName = "哈利波特第1集" });
     cart.AddBook(new Book() { bookName = "哈利波特第2集" });
     cart.AddBook(new Book() { bookName = "哈利波特第3集" });
     cart.AddBook(new Book() { bookName = "哈利波特第3集" });
     var expected = 370;
     //act
     var actual = cart.CalPrice();
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #3
0
        public void 第1集買了_1_本_第2集買了_1_本_第3集買了_1_本_價格應為_270元()
        {
            //arrange
            var cart = new Cart();
            cart.AddBook(new Book() { bookName = "哈利波特第1集" });
            cart.AddBook(new Book() { bookName = "哈利波特第2集" });
            cart.AddBook(new Book() { bookName = "哈利波特第3集" });
            var expected = 270;
            //act
            var actual = cart.CalPrice();

            Console.WriteLine("ClassCleanup");
            //assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #4
0
 public void 買了整套_價格應為_375元()
 {
     //arrange
     var cart = new Cart();
     cart.AddBook(new Book() { bookName = "哈利波特第1集" });
     cart.AddBook(new Book() { bookName = "哈利波特第2集" });
     cart.AddBook(new Book() { bookName = "哈利波特第3集" });
     cart.AddBook(new Book() { bookName = "哈利波特第4集" });
     cart.AddBook(new Book() { bookName = "哈利波特第5集" });
     var expected = 375;
     //act
     var actual = cart.CalPrice();
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #5
0
 static void Main(string[] args)
 {
     var cart = new Cart();
     cart.AddBook(new Book() { bookName = "哈利波特第1集" });
     cart.AddBook(new Book() { bookName = "哈利波特第2集" });
     cart.AddBook(new Book() { bookName = "哈利波特第3集" });
     cart.AddBook(new Book() { bookName = "哈利波特第3集" });
     //act
     var actual = cart.CalPrice();
     Console.WriteLine(actual);
     Console.ReadLine();
 }