Exemplo n.º 1
0
        public static ValidatorSettings WithPolishTranslation(this ValidatorSettings @this)
        {
            ThrowHelper.NullArgument(@this, nameof(@this));

            return(@this.WithTranslation(nameof(Translation.Polish), Translation.Polish));
        }
Exemplo n.º 2
0
        public static IRuleOut <int> Between(this IRuleIn <int> @this, int min, int max)
        {
            ThrowHelper.InvalidRange(min, nameof(min), max, nameof(max));

            return(@this.RuleTemplate(m => m > min && m < max, MessageKey.Numbers.Between, Arg.Number(nameof(min), min), Arg.Number(nameof(max), max)));
        }
Exemplo n.º 3
0
        public static IRuleOut <int?> BetweenOrEqualTo(this IRuleIn <int?> @this, int min, int max)
        {
            ThrowHelper.InvalidRange(min, nameof(min), max, nameof(max));

            return(@this.RuleTemplate(m => m.Value >= min && m.Value <= max, MessageKey.Numbers.BetweenOrEqualTo, Arg.Number(nameof(min), min), Arg.Number(nameof(max), max)));
        }
Exemplo n.º 4
0
        public static IWithCodeOut <T> WithCode <T>(this IWithCodeIn <T> @this, string code)
        {
            ThrowHelper.NullArgument(@this, nameof(@this));

            return(((SpecificationApi <T>)@this).AddCommand(new WithCodeCommand(code)));
        }