private void ValidateGizmo() { if (ProductCode.Substring(1).Length != 3) { throw new InvalidException("Gizmo codes must contain 3 digits"); } }
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"); } }