public RequestValidationError(string propertyName, string errorCode, ValidationErrorType errorType, string errorMessage) { PropertyName = propertyName; ErrorCode = errorCode; ErrorType = errorType; ErrorMessage = errorMessage; }
public ValidationError(ValidationErrorType type, string source, int?line, string description) { Type = type; Source = source; Line = line; Description = description; }
/// <summary>Ctor for exception thrown when entity instance validation fails for any reason.</summary> /// <param name="pErrorType">Type of validation failure.</param> /// <param name="pErrantEntity">The entity instance that failed.</param> /// <param name="pValidationResult">Validation result from the validation processes identified by the ErrorType.</param> /// <remarks> /// The exception message is taken from the ValidationResult passed into the exception at construction. /// </remarks> public ValidationException(ValidationErrorType pErrorType, BusinessBase pErrantEntity, ValidationResult pValidationResult) : base(pValidationResult.Message) { mErrorType = pErrorType; mErrantEntity = pErrantEntity; mValidationResult = pValidationResult; }
public ValidationError(string fieldName, ValidationErrorType type, string errorMessage) { this.FieldName = fieldName; this.Type = type; this.ErrorMessage = !string.IsNullOrEmpty(errorMessage)?errorMessage: string.Format("{0}: {1}", fieldName, type); }
internal static ValidationErrorInfo ComposeValidationError( this ValidationContext validationContext, ValidationErrorType errorType, OpenXmlElement?element, OpenXmlElement?child, string messageId, params object?[] args) { var message = ValidationResources.ResourceManager.GetString(messageId); var description = message switch { null => SR.Format(ExceptionMessages.UnknownError, messageId), _ => SR.Format(message, args), }; return(new ValidationErrorInfo { ErrorType = errorType, Part = validationContext.Stack.Current.Part, Node = element, Id = messageId, RelatedNode = child, Description = description, }); }
private ValidationError AddValidationError(XmlNode n, ValidationErrorType type) { ValidationError ve = new ValidationError(n, type); AddValidationError(n, ve); return(ve); }
public ValidationError(Span span, string description) { Span = span; Description = description; Severity = ValidationErrorSeverity.Error; Type = ValidationErrorType.Syntactic; }
/// <summary> Gets the default validation message format by error type. </summary> private string GetDefaultValidationMessageFormat(ValidationErrorType errorType) { switch (errorType) { case ValidationErrorType.InvalidFormat: return("Invalid '{0}' format."); case ValidationErrorType.Required: return("The field '{0}' is required."); case ValidationErrorType.MinLength: return("Too short '{0}'. Min length: {1}."); case ValidationErrorType.MaxLength: return("Too long '{0}'. Max length: {1}."); case ValidationErrorType.Min: return("Please select at least {1} '{0}'."); case ValidationErrorType.Max: return("Please select less than {1} '{0}'."); case ValidationErrorType.SelectSingle: return("Please select {1} '{0}'."); case ValidationErrorType.SelectMultiple: return("Please select {1} '{0}'."); case ValidationErrorType.CalendarMinDate: return("Min value of '{0}' is {1}."); case ValidationErrorType.CalendarMaxDate: return("Max value of '{0}' is {1}."); case ValidationErrorType.CalendarMinStartDate: return("The value of '{0}' can not be earlier than the start date '{1}'."); case ValidationErrorType.CalendarMaxEndDate: return("The value of '{0}' can not exceed the end date '{1}'."); case ValidationErrorType.FileUploadMin: return("Minimum files for '{0}' is {1}."); case ValidationErrorType.FileUploadMax: return("Maximum files for '{0}' is {1}."); case ValidationErrorType.FileUploadExtension: return("Invalid extension for '{0}' ({1})."); case ValidationErrorType.MissingRangelabel: return("Missing range label for '{0}'"); case ValidationErrorType.DuplicateRanges: return("Duplicate range '{0}'"); default: throw new ArgumentOutOfRangeException("errorType"); } }
public static ValidationErrorResponse Create(ValidationErrorType type, string value) { return(new ValidationErrorResponse { Type = type, Value = value }); }
public DomainException(ValidationErrors validationErrors, ValidationErrorType errorType = ValidationErrorType.Body) { ValidationErrors = validationErrors; foreach (var validationError in ValidationErrors.ErrorItems) { validationError.ErrorType = EnumUtility.GetDescriptions(errorType); } }
public ValidationErrorException( IReadOnlyList <string> properties, ValidationErrorType type ) { Properties = properties; Type = type; }
public ValidationErrorException( string property, ValidationErrorType type ) : this( new[] { property }, type ) { }
public void AddError(string name, string message, ValidationErrorType errorType) { this.AddError(new ValidationResultItem { Name = name?.ToLowerFirstLetter(), Message = message, ResultType = errorType }); }
public ValidationError(string description, ValidationErrorSeverity severity, ValidationErrorType type, string file, int line, int column) : this(description) { Severity = severity; Type = type; File = file; Line = line; Column = column; }
private static ValidationCheckResultEntry GetErrorResult(ValidationErrorType errorType, string propertyNameFrom, string propertyNameTo) { return(new ValidationCheckResultEntry { MethodType = ValidationMethodType.RangeFromOrTo, ErrorType = errorType, PropertyNameFrom = propertyNameFrom, PropertyNameTo = propertyNameTo }); }
private static ValidationCheckResultEntry GetErrorResult(ValidationErrorType errorType, string fieldFromId, string fieldToId) { return(new ValidationCheckResultEntry { MethodType = ValidationMethodType.RangeFromOrTo, ErrorType = errorType, PropertyNameFrom = fieldFromId, PropertyNameTo = fieldToId }); }
public ValidationExpression( Expression <Func <TModel, bool> > isInvalidPredicate, IReadOnlyList <string> properties, ValidationErrorType type ) { IsInvalidPredicate = isInvalidPredicate; Properties = properties; Type = type; }
public ValidationError(ValidationErrorType errorType, Coordinate pt) { if (pt == null) { throw new ArgumentNullException("pt"); } this.errorType = errorType; this.pt = pt.Clone(); }
public static string GetResourceString(this ValidationErrorType validationErrorType) { var resourceString = StringRes.ResourceManager.GetString($"ValidationError_{validationErrorType}"); if (string.IsNullOrWhiteSpace(resourceString)) { resourceString = StringRes.UndefinedErrorString; } return(resourceString); }
public void addError( ValidationErrorSeverity severity, ValidationErrorType errorType, string text, String file, int line, int column) { ValidationError error = new ValidationError(text, severity, errorType, file, line, column); this.errorList.Add(error); }
public void CreateError(string id, ValidationErrorType errorType, string description = null) { var error = new ValidationErrorInfo { Id = id, Description = description, Part = _part, ErrorType = errorType, Node = _element, }; AddError(error); }
public ValidationInfo(OpenXmlPowerToolsDocument doc, ValidationErrorInfo err) { Document = doc; FileName = doc.FileName; Description = err.Description; ErrorType = err.ErrorType; Id = err.Id; Node = err.Node; Part = err.Part; XPath = err.Path.XPath; RelatedNode = err.RelatedNode; RelatedPart = err.RelatedPart; }
public void ValidatorTests_PriceLessThan20_DaysToSellBiggerThanZero_Returns_True_None() { var cheese = new Cheese { Price = 18, DaysToSell = 5 }; const ValidationErrorType expectedValidationErrorType = ValidationErrorType.None; const bool expectedValidationResult = true; var validationResult = _cheeseValidator.Validate(cheese); Assert.AreEqual(expectedValidationResult, validationResult.Item1); Assert.AreEqual(expectedValidationErrorType, validationResult.Item2); }
public void ValidatorTests_PriceBiggerThan20_Returns_False_DaysToSellPassed() { var cheese = new Cheese { Price = 21 }; const ValidationErrorType expectedValidationErrorType = ValidationErrorType.ExceededMaximumPrice; const bool expectedValidationResult = false; var validationResult = _cheeseValidator.Validate(cheese); Assert.AreEqual(expectedValidationResult, validationResult.Item1); Assert.AreEqual(expectedValidationErrorType, validationResult.Item2); }
public void ValidatorTests_PriceLessThanZero_Returns_False_ExceededMinimumPrice() { var cheese = new Cheese { Price = -1 }; const ValidationErrorType expectedValidationErrorType = ValidationErrorType.ExceededMinimumPrice; const bool expectedValidationResult = false; var validationResult = _cheeseValidator.Validate(cheese); Assert.AreEqual(expectedValidationResult, validationResult.Item1); Assert.AreEqual(expectedValidationErrorType, validationResult.Item2); }
public void ValidatorTests_DaysToSellZero_Returns_False_DaysToSellPassed() { var cheese = new Cheese { DaysToSell = 0 }; const ValidationErrorType expectedValidationErrorType = ValidationErrorType.DaysToSellPassed; const bool expectedValidationResult = false; var validationResult = _cheeseValidator.Validate(cheese); Assert.AreEqual(expectedValidationResult, validationResult.Item1); Assert.AreEqual(expectedValidationErrorType, validationResult.Item2); }
public ValidationError(String message, FieldReference fieldReference, ValidationErrorType validationErrorType) { if (String.IsNullOrEmpty(message) == true) { throw new ArgumentNullException(nameof(message)); } if (fieldReference == null) { throw new ArgumentNullException(nameof(fieldReference)); } Message = message; Type = validationErrorType; FieldReference = fieldReference; }
private static ValidationCheckResult GetErrorResult(ValidationErrorType errorType, string fieldId) { return(new ValidationCheckResult { ValidationErrors = new List <ValidationCheckResultEntry> { new ValidationCheckResultEntry { MethodType = ValidationMethodType.String, ErrorType = errorType, PropertyName = fieldId } } }); }
private static ValidationCheckResult GetErrorResult(ValidationErrorType errorType, string propertyName) { return(new ValidationCheckResult { ValidationErrors = new List <ValidationCheckResultEntry> { new ValidationCheckResultEntry { MethodType = ValidationMethodType.DecimalPlaces, ErrorType = errorType, PropertyName = propertyName } } }); }
public void CreateError(string id, ValidationErrorType errorType, string description = null) { var current = Stack.Current; var error = new ValidationErrorInfo { Id = id, Description = description, Part = current.Part, ErrorType = errorType, Node = current.Element, }; AddError(error); }
public ErrorFilterViewModel(ValidationErrorType errorType) { ErrorType = errorType; }
public ValidationErrorWithLookup(string name, ValidationErrorType type, bool isFatal, int line, int col) : this(name, type, isFatal, line) { Col = col; }
public ValidationErrorWithLookup(string name, ValidationErrorType type, bool isFatal, int line) : this(name, type, isFatal) { Line = line; }
public ValidationErrorWithLookup(string name, ValidationErrorType type, bool isFatal) : this(name, type) { IsFatal = isFatal; }
public ValidationErrorWithLookup(string name, ValidationErrorType type) : this(name) { Type = type; }
public SemanticValidationError(string message, ValidationErrorType errorType) { _message = message; _errorType = errorType; }
public ValidationError(Span span, string description, ValidationErrorSeverity severity, ValidationErrorType type) : this(span, description) { Severity = severity; Type = type; }
public void ProcessError(XmlNode n, ValidationErrorType type) { ValidationError ve=AddValidationError(n, type); }
private ValidationError AddValidationError(XmlNode n, ValidationErrorType type) { ValidationError ve=new ValidationError(n, type); AddValidationError(n, ve); return ve; }
internal static ValidationErrorInfo ComposeValidationError(this ValidationContext validationContext, ValidationErrorType errorType, OpenXmlElement element, OpenXmlElement child, string messageId, params string[] args) { ValidationErrorInfo errorInfo = new ValidationErrorInfo() { ErrorType = errorType, Part = validationContext.Part, Node = element, Id = messageId, RelatedNode = child, Description = string.Format(CultureInfo.CurrentUICulture, ValidationResources.ResourceManager.GetString(messageId), args) }; return errorInfo; }
public void ProcessError(XmlNode n, ValidationErrorType type) { valid=false; }
public ValidationError(string fieldName, ValidationErrorType type) { this.FieldName = fieldName; this.Type = type; }
public ValidationError(ValidationErrorType type, string message, FileInfo project) { Type = type; Message = message; ProjectFile = project; }
public bool HasErrorOfType(ValidationErrorType errorType) { return _validationErrors.Any(e => e.ErrorType == errorType); }