common-library

Fake Captcha from commonlibnet with FakeItEasy and FluentValidation

拟墨画扇 提交于 2019-12-12 17:14:31
问题 I am using the Captcha class from commonlibrary (http://commonlibrarynet.codeplex.com/). My code works and everything but now I'm trying to write the unit test. My validation rule is: RuleFor(x => x.CaptchaUserInput) .NotEmpty() .Must((x, captchaUserInput) => Captcha.IsCorrect(captchaUserInput, x.CaptchaGeneratedText)) .WithMessage("Invalid captcha code"); In my set up code I tried to do the following: A.CallTo(() => Captcha.IsCorrect()).Returns(true); but I get the following error message: