src/GenFx.Tests/IntegerValidatorTest.cs
/// <summary>
/// Tests that the IsValid method works correctly.
/// </summary>
Tests that the IsValid method works correctly.
Tests that the IsValid method works correctly .
[Fact]
        public void IntegerValidator_IsValid()
        {
            int min = 50;
            int max = 100;
            IntegerValidator validator = new IntegerValidator(min, max);
            bool isValid = validator.IsValid(49, "foo", null, out _);
            Assert.False(isValid, "IsValid returned incorrect value.");
            isValid = validator.IsValid(49.999, "foo", null, out _);
            Assert.False(isValid, "IsValid returned incorrect value.");
            isValid = validator.IsValid(50, "foo", null, out _);
            Assert.True(isValid, "IsValid returned incorrect value.");
            isValid = validator.IsValid(75, "foo", null, out _);
            Assert.True(isValid, "IsValid returned incorrect value.");
            isValid = validator.IsValid(100, "foo", null, out _);
            Assert.True(isValid, "IsValid returned incorrect value.");
            isValid = validator.IsValid(100.0000001, "foo", null, out _);
            Assert.False(isValid, "IsValid returned incorrect value.");
            isValid = validator.IsValid(101, "foo", null, out _);
            Assert.False(isValid, "IsValid returned incorrect value.");
        }
[ Fact ] public void IntegerValidator_IsValid ( ) { int min = 50 ; int max = 100 ; IntegerValidator validator = new IntegerValidator ( min , max ) ; bool isValid = validator . IsValid ( 49 , " " , null , out _ ) ; Assert . False ( isValid , " " ) ; isValid = validator . IsValid ( 49.999 , " " , null , out _ ) ; Assert . False ( isValid , " " ) ; isValid = validator . IsValid ( 50 , " " , null , out _ ) ; Assert . True ( isValid , " " ) ; isValid = validator . IsValid ( 75 , " " , null , out _ ) ; Assert . True ( isValid , " " ) ; isValid = validator . IsValid ( 100 , " " , null , out _ ) ; Assert . True ( isValid , " " ) ; isValid = validator . IsValid ( 100.0000001 , " " , null , out _ ) ; Assert . False ( isValid , " " ) ; isValid = validator . IsValid ( 101 , " " , null , out _ ) ; Assert . False ( isValid , " " ) ; }
Tests that the IsValid method works correctly.
Tests that the IsValid method works correctly .