public void GetOrderItems_ShouldReturnAnEmptyList_WhenOrderListIsInitialized() { _sut = new OrderList(); var itemsInTheList = _sut.GetOrderItems(); Assert.AreEqual(0, itemsInTheList.Count, "Order list should not contain any item"); }
public void GetOrderItems_ShouldReturnAListWithTwoItems_WhenTwoOrderItemsWhereAdded() { var stockItemA = new StockItem("A"); var stockItemB = new StockItem("B"); var priceA = 1.25m; var priceB = 4.25m; _sut.AddItem(stockItemA, priceA); _sut.AddItem(stockItemB, priceB); var itemsInTheList = _sut.GetOrderItems(); Assert.AreEqual(2, itemsInTheList.Count, "Order list should contain 2 items"); Assert.IsTrue(itemsInTheList.Any(i => i.ItemCode == stockItemA.Code && i.Price == priceA), "List should contain stockitem1 with correct price"); Assert.IsTrue(itemsInTheList.Any(i => i.ItemCode == stockItemB.Code && i.Price == priceB), "List should contain stockitem2 with correct price"); }