public virtual void testMinValidator()
        {
            var validator = new MinValidator();

            Assert.True(validator.Validate(null, null));

            Assert.True(validator.Validate(4, new TestValidatorContext("4")));
            Assert.IsFalse(validator.Validate(4, new TestValidatorContext("5")));

            try
            {
                validator.Validate(4, new TestValidatorContext("4.4"));
                Assert.Fail("exception expected");
            }
            catch (FormException e)
            {
                Assert.True(
                    e.Message.Contains("Cannot validate Integer value 4: configuration 4.4 cannot be parsed as Integer."));
            }

            Assert.IsFalse(validator.Validate(4d, new TestValidatorContext("4.1")));
            Assert.True(validator.Validate(4.1d, new TestValidatorContext("4.1")));

            Assert.IsFalse(validator.Validate(4f, new TestValidatorContext("4.1")));
            Assert.True(validator.Validate(4.1f, new TestValidatorContext("4.1")));
        }
    public void Validate_Ok()
    {
        var foo       = new Foo();
        var validator = new MinValidator()
        {
            Value = 2
        };
        var context = new ValidationContext(foo);
        var results = new List <ValidationResult>();

        validator.Validate("v1", context, results);
        Assert.Equal($"Select at least {validator.Value} items", results[0].ErrorMessage);
    }