예제 #1
0
        public void RemoveBookEmptyList()
        {
            // Create list, assert empty
            BookOrder bookOrder = new BookOrder();

            Assert.AreEqual(bookOrder.OrderItemList.Count, 0);

            // Attempt remove test order from list using ID, list unchanged
            bookOrder.RemoveItem(testOrderID);
            Assert.IsFalse(bookOrder.OrderItemList.Contains(testOrderItem));
            Assert.AreEqual(bookOrder.OrderItemList.Count, 0);
        }
예제 #2
0
        public void RemoveBookSuccess()
        {
            // Add test order to list, assert in list
            BookOrder bookOrder = new BookOrder();

            bookOrder.AddItem(testOrderItem);
            Assert.IsTrue(bookOrder.OrderItemList.Contains(testOrderItem));

            // Remove from list using ID, assert removed from list
            bookOrder.RemoveItem(testOrderID);
            Assert.IsFalse(bookOrder.OrderItemList.Contains(testOrderItem));
            Assert.AreEqual(bookOrder.OrderItemList.Count, 0);
        }
예제 #3
0
        public void RemoveBookNotInList()
        {
            // Add other order to list, assert in list
            BookOrder bookOrder = new BookOrder();

            bookOrder.AddItem(otherOrderItem);
            Assert.IsTrue(bookOrder.OrderItemList.Contains(otherOrderItem));

            // Attempt remove test order from list using ID, list unchanged
            bookOrder.RemoveItem(testOrderID);
            Assert.IsTrue(bookOrder.OrderItemList.Contains(otherOrderItem));
            Assert.IsFalse(bookOrder.OrderItemList.Contains(testOrderItem));
            Assert.AreEqual(bookOrder.OrderItemList.Count, 1);
        }