public void Validate() { var expireOn = new DateTime(ExpireYear, ExpireMonth, 1).AddMonths(1).AddDays(-1); Contract.Assert(!string.IsNullOrWhiteSpace(FirstName)); Contract.Assert((!Initial.HasValue) || char.IsUpper(Initial.Value)); Contract.Assert(!string.IsNullOrWhiteSpace(LastName)); Contract.Assert(Email.IsEmail()); Contract.Assert(Phone.IsPhone(PhoneKind.EitherFormat)); Contract.Assert(Global.CountryCodes.Contains(Country)); Contract.Assert(Address1.IsTrimmed(100)); Contract.Assert(string.IsNullOrEmpty(Address2) || Address2.IsTrimmed(100)); Contract.Assert(City.IsTrimmed(50)); Contract.Assert(State.IsTrimmed(100)); Contract.Assert(PostalCode.IsTrimmed(100)); Contract.Assert(CardNumber.IsCardNumber()); Contract.Assert((CVV2 >= 100) && (CVV2 <= 9999)); Contract.Assert(expireOn >= DateTime.Today); Details.ForEach(detail => detail.Validate()); }