Пример #1
0
        public void PuzzleExample1()
        {
            string           puzzle  = "1122";
            CaptchaEvaluator captcha = new CaptchaEvaluator();
            int notAHuman            = captcha.EvaluateCaptcha(puzzle);

            Assert.Equal(notAHuman, 3);
        }
Пример #2
0
        public void EndConnects()
        {
            string           digits  = "11";
            CaptchaEvaluator captcha = new CaptchaEvaluator();
            int digitsResult         = captcha.CheckEndMatchFirst(digits);

            Assert.Equal(digitsResult, 1);
        }
Пример #3
0
        public void TwoSameDigits()
        {
            string           digits  = "1122";
            CaptchaEvaluator captcha = new CaptchaEvaluator();
            int digitsResult         = captcha.CheckConsecutiveDigits(digits);

            Assert.Equal(digitsResult, 3);
        }
Пример #4
0
        public void MultiDigitsTwo()
        {
            string           digits  = "2222";
            CaptchaEvaluator captcha = new CaptchaEvaluator();
            int digitsResult         = captcha.CheckConsecutiveDigits(digits);

            Assert.Equal(digitsResult, 6);
        }
Пример #5
0
 public IsValidCaptcha(Expression <Func <TViewModel, string> > questionPropertyExpression, Expression <Func <TViewModel, string> > answerPropertyExpression)
 {
     ConstructorArguments = new List <object> {
         questionPropertyExpression, answerPropertyExpression
     };
     _questionPropertyExpression = questionPropertyExpression;
     _answerPropertyExpression   = answerPropertyExpression;
     PropertyFilter    = new UglyExpressionConvertor().ToString(_questionPropertyExpression);
     _captchaEvaluator = new CaptchaEvaluator();
 }