예제 #1
0
        public ItemFood(ItemFoodModel model, int qty = 1) : base(model, qty)
        {
#if DEBUG
            if (model.IsPerishable)
            {
                throw new InvalidOperationException("wrong constructor");
            }
#endif
            Nutrition = model.Nutrition;
        }
예제 #2
0
        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);
        }