예제 #1
0
파일: Order.cs 프로젝트: Slesa/Playground
 public void RemoveItem(OrderDetails item)
 {
     if(!_items.Contains(item))
         throw new OrderNotFoundException();
     _items.Remove(item);
     Amount -= item.Count*item.Price;
 }
예제 #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
        }
예제 #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);
        }
예제 #4
0
파일: Order.cs 프로젝트: Slesa/Playground
 public void AddItem(OrderDetails item)
 {
     _items.Add(item);
     Amount += item.Price;
 } 
예제 #5
0
 public void GivenIOrderedAnArticle(int count, string article, double price)
 {
     _item = new OrderDetails {Count = count, Article = article, Price = price};
 }