private IEnumerable <ValidationResult> Validate(ValidationContext validationContext, ActionDBTypeEnum actionDBType) { string retStr = ""; Enums enums = new Enums(LanguageRequest); PolSourceInactiveReasonEnumTextAndID polSourceInactiveReasonEnumTextAndID = validationContext.ObjectInstance as PolSourceInactiveReasonEnumTextAndID; polSourceInactiveReasonEnumTextAndID.HasErrors = false; if (string.IsNullOrWhiteSpace(polSourceInactiveReasonEnumTextAndID.Text)) { polSourceInactiveReasonEnumTextAndID.HasErrors = true; yield return(new ValidationResult(string.Format(CSSPServicesRes._IsRequired, "Text"), new[] { "Text" })); } //Text has no StringLength Attribute if (polSourceInactiveReasonEnumTextAndID.ID < 1) { polSourceInactiveReasonEnumTextAndID.HasErrors = true; yield return(new ValidationResult(string.Format(CSSPServicesRes._MinValueIs_, "ID", "1"), new[] { "ID" })); } retStr = ""; // added to stop compiling CSSPError if (retStr != "") // will never be true { polSourceInactiveReasonEnumTextAndID.HasErrors = true; yield return(new ValidationResult("AAA", new[] { "AAA" })); } }
private PolSourceInactiveReasonEnumTextAndID GetFilledRandomPolSourceInactiveReasonEnumTextAndID(string OmitPropName) { PolSourceInactiveReasonEnumTextAndID polSourceInactiveReasonEnumTextAndID = new PolSourceInactiveReasonEnumTextAndID(); if (OmitPropName != "Text") { polSourceInactiveReasonEnumTextAndID.Text = GetRandomString("", 20); } if (OmitPropName != "ID") { polSourceInactiveReasonEnumTextAndID.ID = GetRandomInt(1, 11); } return(polSourceInactiveReasonEnumTextAndID); }
public PolSourceInactiveReasonEnumTextAndIDTest() { polSourceInactiveReasonEnumTextAndID = new PolSourceInactiveReasonEnumTextAndID(); }