public void Test_add_1_book_to_cart_then_checkout_total_should_be_equal_sell_price() { // Arrange var book = new Book { Id = 1, Name = "Harry Potter and the Philosopher's Stone", SellPrice = 100 }; var expected = 100; var target = new Cart(); target.Add(book); target.Checkout(); // Act var actual = target.Total; // Assert Assert.AreEqual(expected, actual); }
public void Test_add_2_different_books_to_cart_then_checkout_total_should_be_equal_sell_price_5_percent_save_off() { // Arrange var book_1 = new Book { Id = 1, Name = "Harry Potter and the Philosopher's Stone", SellPrice = 100 }; var book_2 = new Book { Id = 2, Name = "Harry Potter and the Chamber of Secrets", SellPrice = 100 }; var expected = 190; var target = new Cart(); target.Add(book_1); target.Add(book_2); target.Checkout(); // Act var actual = target.Total; // Assert Assert.AreEqual(expected, actual); }
public void AddBook(Book book) { _order.Add(book); }
public void Test_add_3_diff_1_same_books_to_cart_then_checkout_total_should_be_equal_370() { // Arrange var book_1 = new Book { Id = 1, Name = "Harry Potter and the Philosopher's Stone", SellPrice = 100 }; var book_2 = new Book { Id = 2, Name = "Harry Potter and the Chamber of Secrets", SellPrice = 100 }; var book_3 = new Book { Id = 3, Name = "Harry Potter and the Prisoner of Azkaban", SellPrice = 100 }; var book_4 = new Book { Id = 3, Name = "Harry Potter and the Prisoner of Azkaban", SellPrice = 100 }; var expected = 370; var target = new Cart(); target.Add(book_1); target.Add(book_2); target.Add(book_3); target.Add(book_4); target.Checkout(); // Act var actual = target.Total; // Assert Assert.AreEqual(expected, actual); }
public void Test_add_5_different_books_to_cart_then_checkout_total_should_be_equal_sell_price_25_percent_save_off() { // Arrange var book_1 = new Book { Id = 1, Name = "Harry Potter and the Philosopher's Stone", SellPrice = 100 }; var book_2 = new Book { Id = 2, Name = "Harry Potter and the Chamber of Secrets", SellPrice = 100 }; var book_3 = new Book { Id = 3, Name = "Harry Potter and the Prisoner of Azkaban", SellPrice = 100 }; var book_4 = new Book { Id = 4, Name = "Harry Potter and the Goblet of Fire", SellPrice = 100 }; var book_5 = new Book { Id = 5, Name = "Harry Potter and the Order of the Phoenix", SellPrice = 100 }; var expected = 375; var target = new Cart(); target.Add(book_1); target.Add(book_2); target.Add(book_3); target.Add(book_4); target.Add(book_5); target.Checkout(); // Act var actual = target.Total; // Assert Assert.AreEqual(expected, actual); }
public void Add(Book book) { books.Add(book); }