Exemplo n.º 1
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (ContactInformation == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ContactInformation");
     }
     if (ContactInformation != null)
     {
         ContactInformation.Validate();
     }
     if (ShippingAddress != null)
     {
         ShippingAddress.Validate();
     }
     if (CurrentStatus != null)
     {
         CurrentStatus.Validate();
     }
     if (OrderHistory != null)
     {
         foreach (var element in OrderHistory)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }