示例#1
0
        public void Octal_Validator_Test()
        {
            IValidator validator = new Implementations.Validator();

            // valid inputs:
            validator.IsValidOctal("1234567.1234567").Should().BeTrue();
            validator.IsValidOctal("1234567.0").Should().BeTrue();

            // invalid inputs
            validator.IsValidOctal("1234567.1234567.1234567").Should().BeFalse();
            validator.IsValidOctal(".1234567").Should().BeFalse();
            validator.IsValidOctal("1234567.").Should().BeFalse();
            validator.IsValidOctal("1234567").Should().BeFalse();
            validator.IsValidOctal(",1234567").Should().BeFalse();
            validator.IsValidOctal("1234567,1234567").Should().BeFalse();
            validator.IsValidOctal("1234567,").Should().BeFalse();
            validator.IsValidOctal("1234567.1234567.1234567").Should().BeFalse();
            validator.IsValidOctal(".1234567").Should().BeFalse();
            validator.IsValidOctal("1234567.").Should().BeFalse();
            validator.IsValidOctal("1234567").Should().BeFalse();
            validator.IsValidOctal(",1234567").Should().BeFalse();
            validator.IsValidOctal("1234567,1234567").Should().BeFalse();
            validator.IsValidOctal("1234567,").Should().BeFalse();
        }
示例#2
0
        public void Binary_Validator_Test()
        {
            IValidator validator = new Implementations.Validator();

            // valid inputs:
            validator.IsValidBinary("111.111").Should().BeTrue();
            validator.IsValidBinary("111.0").Should().BeTrue();

            // invalid inputs
            validator.IsValidBinary("111.111.111").Should().BeFalse();
            validator.IsValidBinary(".111").Should().BeFalse();
            validator.IsValidBinary("111.").Should().BeFalse();
            validator.IsValidBinary("111").Should().BeFalse();
            validator.IsValidBinary(",111").Should().BeFalse();
            validator.IsValidBinary("111,111").Should().BeFalse();
            validator.IsValidBinary("111,").Should().BeFalse();
            validator.IsValidBinary("112.112.112").Should().BeFalse();
            validator.IsValidBinary(".112").Should().BeFalse();
            validator.IsValidBinary("112.").Should().BeFalse();
            validator.IsValidBinary("112").Should().BeFalse();
            validator.IsValidBinary(",112").Should().BeFalse();
            validator.IsValidBinary("121,121").Should().BeFalse();
            validator.IsValidBinary("211,").Should().BeFalse();
        }
示例#3
0
        public void Decimal_Validator_Test()
        {
            IValidator validator = new Implementations.Validator();

            // valid inputs:
            validator.IsValidDecimal("123456789.123456789").Should().BeTrue();
            validator.IsValidDecimal("123456789.0").Should().BeTrue();

            // invalid inputs
            validator.IsValidDecimal("123456789.123456789.123456789").Should().BeFalse();
            validator.IsValidDecimal(".123456789").Should().BeFalse();
            validator.IsValidDecimal("123456789.").Should().BeFalse();
            validator.IsValidDecimal("123456789").Should().BeFalse();
            validator.IsValidDecimal(",123456789").Should().BeFalse();
            validator.IsValidDecimal("123456789,123456789").Should().BeFalse();
            validator.IsValidDecimal("123456789,").Should().BeFalse();
            validator.IsValidDecimal("123456789.123456789.123456789").Should().BeFalse();
            validator.IsValidDecimal(".123456789").Should().BeFalse();
            validator.IsValidDecimal("123456789.").Should().BeFalse();
            validator.IsValidDecimal("123456789").Should().BeFalse();
            validator.IsValidDecimal(",123456789").Should().BeFalse();
            validator.IsValidDecimal("123456789,123456789").Should().BeFalse();
            validator.IsValidDecimal("123456789,").Should().BeFalse();
        }
示例#4
0
        public void Is_Valid_Hexadecimal_Test()
        {
            IValidator validator = new Implementations.Validator();

            // valid inputs:
            validator.IsValidHexadecimal("123456789ABCDEF.123456789ABCDEF").Should().BeTrue();
            validator.IsValidHexadecimal("123456789ABCDEF.0").Should().BeTrue();

            // invalid inputs
            validator.IsValidHexadecimal("123456789ABCDEF.123456789ABCDEF.123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal(".123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF.").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal(",123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF,123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF,").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF.123456789ABCDEF.123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal(".123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF.").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal(",123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF,123456789ABCDEF").Should().BeFalse();
            validator.IsValidHexadecimal("123456789ABCDEF,").Should().BeFalse();
        }