public ValidateAnswer ( string answerValue ) : bool | ||
answerValue | string | This could be the hashed value of the image path or the answer to an audio question |
Résultat | bool |
public void ValidImageOption_Succeeds() { for (var i = 0; i < 100; i++) { var captcha = new Captcha(5); var data = captcha.GetFrontEndData(); Assert.IsTrue( captcha.ValidateAnswer(data.Values.FirstOrDefault(v => v == captcha.ValidImageOption.Value))); } }
public void InvalidImageOptions_Fail() { for (var i = 0; i < 100; i++) { var captcha = new Captcha(5); var data = captcha.GetFrontEndData(); foreach (var option in data.Values.Where(option => option != captcha.ValidImageOption.Value)) { Assert.IsFalse(captcha.ValidateAnswer(option)); } } }