Esempio n. 1
0
        public override ValidationResult Validate()
        {
            IPinForValidationDto pinForValidationDto = ValidationContext.ObjectInstance as IPinForValidationDto;

            if (pinForValidationDto == null)
            {
                throw new Exception("Object for validation is null");
            }

            int[] pinDigits = StringDigitsToIntArrayConverter.GetDigits(pinForValidationDto.Pin);

            if (PinIs0011(pinDigits))
            {
                return(new ValidationResult(false, "Pin cannot be 0011."));
            }

            return(new ValidationResult(true, null));
        }
        public override ValidationResult Validate()
        {
            IPinForValidationDto pinForValidationDto = ValidationContext.ObjectInstance as IPinForValidationDto;

            if (pinForValidationDto == null)
            {
                throw new Exception("Object for validation is null");
            }

            int[] pinDigits = StringDigitsToIntArrayConverter.GetDigits(pinForValidationDto.Pin);

            if (IsCompleteConsecutiveNumberSequence(pinDigits))
            {
                return(new ValidationResult(false, "Pin in invalid. It is complete sequencial"));
            }


            return(new ValidationResult(true, null));
        }