private void ValidateEvent(InventoryEvent inventoryEvent)
 {
     if (Stock + inventoryEvent.Quantity < 0)
     {
         throw new ArgumentException("Cannot withdraw below stock of " + Stock);
     }
 }
Exemplo n.º 2
0
 private void ValidateEvent(InventoryEvent inventoryEvent)
 {
     if (Stock + inventoryEvent.Quantity < 0)
     {
         throw new ArgumentException("Cannot withdraw below stock of " + Stock);
     }
 }
        internal void Apply(InventoryEvent inventoryEvent)
        {
            ValidateEvent(inventoryEvent);

            Stock += inventoryEvent.Quantity;
            Events.Add(inventoryEvent);
        }
Exemplo n.º 4
0
        internal void Apply(InventoryEvent inventoryEvent)
        {
            ValidateEvent(inventoryEvent);

            Stock += inventoryEvent.Quantity;
            Events.Add(inventoryEvent);
        }