Esempio n. 1
0
        public static ILeoValueRuleBuilder <T, TVal> Matches <T, TVal>(this ILeoValueRuleBuilder <T, TVal> builder, Expression <Func <T, string> > expression, RegexOptions options)
        {
            var current         = builder._impl();
            var regexExpression = PropertyValueGetter.Get(expression, current.CorrespondingInstance);

            return(builder.Matches(regexExpression, options));
        }
Esempio n. 2
0
        public static ILeoValueRuleBuilder <T, TItem[]> All <T, TItem>(this ILeoValueRuleBuilder <T, TItem[]> builder, Func <TItem, bool> func)
        {
            var current = builder._impl();

            current.CurrentToken = new ValueAllToken <TItem[], TItem>(current._member, func);
            return(builder);
        }
Esempio n. 3
0
        public static ILeoValueRuleBuilder <T, TVal> WithMessage <T, TVal>(this ILeoValueRuleBuilder <T, TVal> builder, string message, bool appendOrOverwrite)
        {
            var current = builder._impl().CurrentToken;

            if (current != null)
            {
                if (current.WithMessageMode)
                {
                    if (appendOrOverwrite)
                    {
                        current.CustomMessage += message;
                    }
                    else
                    {
                        current.CustomMessage = message;
                    }
                }
                else
                {
                    current.CustomMessage     = message;
                    current.AppendOrOverwrite = appendOrOverwrite;
                    current.WithMessageMode   = true;
                }
            }

            return(builder);
        }
Esempio n. 4
0
        public static ILeoValueRuleBuilder <T, TVal> All <T, TVal, TItem>(this ILeoValueRuleBuilder <T, TVal> builder, Func <TItem, bool> func)
            where TVal : ICollection <TItem>
        {
            var current = builder._impl();

            current.CurrentToken = new ValueAllToken <TVal, TItem>(current._member, func);
            return(builder);
        }