public async void Test_GreaterThanLongChecker() { var checker = new GreaterThanLongChecker <Student>(5L, _Validation); var result = await checker.ValidateAsync(new ValidateResult(), 6L, "", ""); Assert.True(result.IsValid); result = await checker.ValidateAsync(new ValidateResult(), 3L, "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 {0}", 5L), result.Failures[0].Error); Assert.Equal(3L, result.Failures[0].Value); result = await checker.ValidateAsync(new ValidateResult(), 5L, "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(5L, result.Failures[0].Value); }
public async void Test_GreaterThanLongChecker() { var checker = new GreaterThanLongChecker<Student>(5L, _Validation); var result = await checker.ValidateAsync(new ValidateResult(), 6L, "", ""); Assert.True(result.IsValid); result = await checker.ValidateAsync(new ValidateResult(), 3L, "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 {0}", 5L), result.Failures[0].Error); Assert.Equal(3L, result.Failures[0].Value); result = await checker.ValidateAsync(new ValidateResult(), 5L, "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(5L, result.Failures[0].Value); }