예제 #1
0
        public void ValidationPassesWhenArrayLengthIsWithinBoundaries(ICollection <int> array)
        {
            var attribute = new IntArrayLengthAttribute("Field", 3, 1);

            var isValid = attribute.IsValid(array);

            Assert.True(isValid);
        }
예제 #2
0
        public void ValidationFailsWhenArrayLengthIsNotBetweenOneAndThree(ICollection <int> array)
        {
            var attribute = new IntArrayLengthAttribute("Field", 3, 1);

            var isValid = attribute.IsValid(array);

            Assert.False(isValid);
        }
예제 #3
0
        public void ValidationFailsWhenMinLengthIsNotSetAndArrayIsNull()
        {
            List <int> array     = null;
            var        attribute = new IntArrayLengthAttribute("Field", 3);

            var isValid = attribute.IsValid(array);

            Assert.False(isValid);
        }
예제 #4
0
        public void ValidationPassesWhenMinLengthIsNotSetAndArrayIsEmpty()
        {
            var array     = new List <int>();
            var attribute = new IntArrayLengthAttribute("Field", 3);

            var isValid = attribute.IsValid(array);

            Assert.True(isValid);
        }