Example #1
0
        public void AddCandy(Candies candyItem)
        {
            if (candyItem == null)
            {
                throw new ArgumentNullException("ERROR: The object is empty. Please specify candy parameters");
            }

            insideBox.Add(candyItem);
        }
Example #2
0
 public void DeleteCandy(Candies candyItem)
 {
     if (insideBox.Count == 0)
     {
         throw new Exception("It is impossible to remove item from the box. The box is empty");
     }
     if (insideBox.Contains(candyItem))
     {
         insideBox.Remove(candyItem);
     }
     else
     {
         throw new ArgumentException("ERROR: Item is absent in the box");
     }
 }