Example #1
0
 private void ValidateGizmo()
 {
     if (ProductCode.Substring(1).Length != 3)
     {
         throw new InvalidException("Gizmo codes must contain 3 digits");
     }
 }
Example #2
0
        private void ValidateWidget()
        {
            if (ProductCode.Substring(1).Length != 4)
            {
                throw new InvalidException("Widget codes must contain 4 digits");
            }

            if (Quantity % 1 != 0)
            {
                throw new InvalidException("Widget are sold by the unit so quantity must be whole number");
            }
        }