/// <summary> /// Validate function for all VPResValuesService commands /// </summary> /// <param name="validationContext">System.ComponentModel.DataAnnotations.ValidationContext (Describes the context in which a validation check is performed.)</param> /// <param name="actionDBType">[ActionDBTypeEnum] (CSSPEnums.ActionDBTypeEnum.html) action type to validate</param> /// <returns>IEnumerable of ValidationResult (Where ValidationResult is a container for the results of a validation request.)</returns> private IEnumerable <ValidationResult> Validate(ValidationContext validationContext, ActionDBTypeEnum actionDBType) { string retStr = ""; Enums enums = new Enums(LanguageRequest); VPResValues vpResValues = validationContext.ObjectInstance as VPResValues; vpResValues.HasErrors = false; if (vpResValues.Conc < 0) { vpResValues.HasErrors = true; yield return(new ValidationResult(string.Format(CSSPServicesRes._MinValueIs_, "Conc", "0"), new[] { "Conc" })); } //Dilu has no Range Attribute //FarfieldWidth has no Range Attribute //Distance has no Range Attribute //TheTime has no Range Attribute //Decay has no Range Attribute retStr = ""; // added to stop compiling CSSPError if (retStr != "") // will never be true { vpResValues.HasErrors = true; yield return(new ValidationResult("AAA", new[] { "AAA" })); } }
private VPResValues GetFilledRandomVPResValues(string OmitPropName) { VPResValues vpResValues = new VPResValues(); if (OmitPropName != "Conc") { vpResValues.Conc = GetRandomInt(0, 10); } // should implement a Range for the property Dilu and type VPResValues // should implement a Range for the property FarfieldWidth and type VPResValues // should implement a Range for the property Distance and type VPResValues // should implement a Range for the property TheTime and type VPResValues // should implement a Range for the property Decay and type VPResValues return(vpResValues); }
public VPResValuesTest() { vPResValues = new VPResValues(); }