public void RemoveItem(OrderDetails item) { if(!_items.Contains(item)) throw new OrderNotFoundException(); _items.Remove(item); Amount -= item.Count*item.Price; }
public void RemoveUnexistingOrder() { // Arrange var order = new Order(); var item = new OrderDetails {Article = "Test", Count = 1, Price = 0.99}; // Act order.RemoveItem(item); // Assert by attribute }
public void AddingOrderItemToOrder() { // Arrange var order = new Order(); var item = new OrderDetails {Article = "Test", Count = 2, Price = 0.99}; // Act order.AddItem(item); // Assert Assert.AreEqual(order.Items.Count(), 1); Assert.AreEqual(order.Amount, 0.99); }
public void AddItem(OrderDetails item) { _items.Add(item); Amount += item.Price; }
public void GivenIOrderedAnArticle(int count, string article, double price) { _item = new OrderDetails {Count = count, Article = article, Price = price}; }