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); }