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));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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));
        }
Exemple #7
0
        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));
        }