public async void Test_GreaterThanOrEqualFloatChecker()
        {
            var checker = new GreaterThanOrEqualFloatChecker<Student>(5f, _Validation);

            var result = await checker.ValidateAsync(new ValidateResult(), 6f, "", "");
            Assert.True(result.IsValid);

            result = await checker.ValidateAsync(new ValidateResult(), 3f, "a", null);
            Assert.False(result.IsValid);
            Assert.Equal(1, result.Failures.Count);
            Assert.Equal("a", result.Failures[0].Name);
            Assert.Equal(string.Format("The value must greater than or equal {0}", 5f), result.Failures[0].Error);
            Assert.Equal(3f, result.Failures[0].Value);

            result = await checker.ValidateAsync(new ValidateResult(), 5f, "a1", "c");
            Assert.True(result.IsValid);
        }
Exemplo n.º 2
0
        public async void Test_GreaterThanOrEqualFloatChecker()
        {
            var checker = new GreaterThanOrEqualFloatChecker <Student>(5f, _Validation);

            var result = await checker.ValidateAsync(new ValidateResult(), 6f, "", "");

            Assert.True(result.IsValid);

            result = await checker.ValidateAsync(new ValidateResult(), 3f, "a", null);

            Assert.False(result.IsValid);
            Assert.Equal(1, result.Failures.Count);
            Assert.Equal("a", result.Failures[0].Name);
            Assert.Equal(string.Format("The value must greater than or equal {0}", 5f), result.Failures[0].Error);
            Assert.Equal(3f, result.Failures[0].Value);

            result = await checker.ValidateAsync(new ValidateResult(), 5f, "a1", "c");

            Assert.True(result.IsValid);
        }