Example #1
0
 public void RemoveItem(OrderDetails item)
 {
     if(!_items.Contains(item))
         throw new OrderNotFoundException();
     _items.Remove(item);
     Amount -= item.Count*item.Price;
 }
Example #2
0
        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
        }
Example #3
0
        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);
        }
Example #4
0
 public void AddItem(OrderDetails item)
 {
     _items.Add(item);
     Amount += item.Price;
 } 
Example #5
0
 public void GivenIOrderedAnArticle(int count, string article, double price)
 {
     _item = new OrderDetails {Count = count, Article = article, Price = price};
 }