コード例 #1
0
 public void IsValidMinLengthMustReturnTrueWhenTheSpecifiedValueLenghtIsBigger()
 {
     LengthValidator lengthValidator = new LengthValidator(1);
     
     Assert.IsTrue(lengthValidator.IsValid("1"));
     Assert.IsTrue(lengthValidator.IsValid("123"));
 }
コード例 #2
0
        public void IsValidBetweenLengthMustReturnTrueWhenTheSpecifiedValueLenghtIsOutsideTheBoundaries()
        {
            LengthValidator lengthValidator = new LengthValidator(1, 5);

            Assert.IsTrue(lengthValidator.IsValid("1"));
            Assert.IsTrue(lengthValidator.IsValid("123"));
            Assert.IsTrue(lengthValidator.IsValid("12345"));
        }
コード例 #3
0
        public void IsValidMinLengthMustReturnFalseWhenTheSpecifiedValueLenghtIsSmaller()
        {
            LengthValidator lengthValidator = new LengthValidator(5);

            Assert.IsFalse(lengthValidator.IsValid(string.Empty));
            Assert.IsFalse(lengthValidator.IsValid("1"));
            Assert.IsFalse(lengthValidator.IsValid("1234"));
        }
コード例 #4
0
        public void IsValidBetweenLengthMustReturnFalseWhenTheSpecifiedValueLenghtIsOutsideTheBoundaries()
        {
            LengthValidator lengthValidator = new LengthValidator(2, 4);

            Assert.IsFalse(lengthValidator.IsValid(string.Empty));
            Assert.IsFalse(lengthValidator.IsValid("1"));
            Assert.IsFalse(lengthValidator.IsValid("12345"));
        }
コード例 #5
0
        public void IsValidMinLengthMustReturnTrueWhenTheSpecifiedValueIsNull()
        {
            LengthValidator lengthValidator = new LengthValidator(5);

            Assert.IsTrue(lengthValidator.IsValid(null));
        }