public static RegexValidationResult CreateMalformedPatternErrorResult(string text, Exception exception, BaseBox box) { var formatAndCulture = SyntaxErrorInRegexPatternFormatAndCulture.GetOrCreate(box.Culture); var message = formatAndCulture.Format; return(new RegexValidationResult(text, box.RegexPattern, exception, box.Culture, formatAndCulture, false, message)); }
public static RegexValidationResult CreateErrorResult(string text, BaseBox box) { var formatAndCulture = PleaseProvideValidInputFormatAndCulture.GetOrCreate(box.Culture); var message = formatAndCulture.Format; return(new RegexValidationResult(text, box.RegexPattern, null, box.Culture, formatAndCulture, false, message)); }
public static RequiredButMissingValidationResult CreateErrorResult <T>(string text, NumericBox <T> box) where T : struct, IFormattable, IComparable <T>, IConvertible, IEquatable <T> { var formatAndCulture = DefaultFormatAndCulture.GetOrCreate(box.Culture); var message = formatAndCulture.Format; return(new RequiredButMissingValidationResult(typeof(T), text, box.Culture, formatAndCulture, false, message)); }
public static CanParseValidationResult CreateErrorResult <T>(string text, NumericBox <T> box) where T : struct, IFormattable, IComparable <T>, IConvertible, IEquatable <T> { var formatAndCulture = PleaseEnterAValidNumberFormatAndCulture.GetOrCreate(box.Culture); var message = formatAndCulture.Format; return(new CanParseValidationResult(typeof(T), text, box.Culture, formatAndCulture, false, message)); }
public static RegexValidationResult CreateMalformedPatternErrorResult(string text, Exception exception, BaseBox box) { var formatAndCulture = SyntaxErrorInRegexPatternFormatAndCulture.GetOrCreate(box.Culture); var message = formatAndCulture.Format; return(new RegexValidationResult( text: text, pattern: box.RegexPattern, exception: exception, currentBoxCulture: box.Culture, formatAndCulture: formatAndCulture, isValid: false, errorContent: message)); }
public static RegexValidationResult CreateErrorResult(string text, BaseBox box) { var formatAndCulture = PleaseProvideValidInputFormatAndCulture.GetOrCreate(box.Culture); var message = formatAndCulture.Format; return(new RegexValidationResult( text: text, pattern: box.RegexPattern, exception: null, currentBoxCulture: box.Culture, formatAndCulture: formatAndCulture, isValid: false, errorContent: message)); }
public static RequiredButMissingValidationResult CreateErrorResult <T>(string text, NumericBox <T> box) where T : struct, IFormattable, IComparable <T>, IConvertible, IEquatable <T> { if (box is null) { throw new ArgumentNullException(nameof(box)); } var formatAndCulture = DefaultFormatAndCulture.GetOrCreate(box.Culture); var message = formatAndCulture.Format; return(new RequiredButMissingValidationResult( type: typeof(T), text: text, currentBoxCulture: box.Culture, formatAndCulture: formatAndCulture, isValid: false, errorContent: message)); }