public async void Test_LessThanDoubleChecker() { var checker = new LessThanDoubleChecker<Student>(5d, _Validation); var result = await checker.ValidateAsync(new ValidateResult(), 3d, "", ""); Assert.True(result.IsValid); result = await checker.ValidateAsync(new ValidateResult(), 7d, "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 less than {0}", 5d), result.Failures[0].Error); Assert.Equal(7d, result.Failures[0].Value); result = await checker.ValidateAsync(new ValidateResult(), 5d, "a1", "c"); Assert.False(result.IsValid); Assert.Equal(1, result.Failures.Count); Assert.Equal("a1", result.Failures[0].Name); Assert.Equal("c", result.Failures[0].Error); Assert.Equal(5d, result.Failures[0].Value); }
public async void Test_LessThanDoubleChecker() { var checker = new LessThanDoubleChecker <Student>(5d, _Validation); var result = await checker.ValidateAsync(new ValidateResult(), 3d, "", ""); Assert.True(result.IsValid); result = await checker.ValidateAsync(new ValidateResult(), 7d, "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 less than {0}", 5d), result.Failures[0].Error); Assert.Equal(7d, result.Failures[0].Value); result = await checker.ValidateAsync(new ValidateResult(), 5d, "a1", "c"); Assert.False(result.IsValid); Assert.Equal(1, result.Failures.Count); Assert.Equal("a1", result.Failures[0].Name); Assert.Equal("c", result.Failures[0].Error); Assert.Equal(5d, result.Failures[0].Value); }