public ItemFood(ItemFoodModel model, int qty = 1) : base(model, qty) { #if DEBUG if (model.IsPerishable) { throw new InvalidOperationException("wrong constructor"); } #endif Nutrition = model.Nutrition; }
public ItemFood(int bestBefore, ItemFoodModel model) : base(model) { #if DEBUG if (0 > bestBefore) { throw new InvalidOperationException("expired in past"); } if (!model.IsPerishable) { throw new InvalidOperationException("wrong constructor"); } #endif Nutrition = model.Nutrition; BestBefore = new WorldTime(bestBefore); }