Exemplo n.º 1
0
        /// <summary>
        /// Initialises a new instance of the <c>ReCaptchaV2</c> class.
        /// </summary>
        /// <param name="settings"><c>ReCaptchaV2Settings</c> instance.</param>
        public ReCaptchaV2(IReCaptchaV2Settings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            this._settings = settings;
        }
Exemplo n.º 2
0
        public void CreateInstance_GivenConfig_Should_ReturnSettings()
        {
            this._settings = ReCaptchaV2Settings.CreateInstance();

            this._settings.Should().NotBeNull();
            this._settings.RequestUrl.Should().Be("https://www.google.com/recaptcha/api/siteverify");
            this._settings.ApiUrl.Should().Be("https://www.google.com/recaptcha/api.js");
            this._settings.SiteKey.Should().NotBeNullOrWhiteSpace();
            this._settings.SecretKey.Should().NotBeNullOrWhiteSpace();
        }
Exemplo n.º 3
0
        public HomeController(IReCaptchaV2Settings settings, IReCaptchaV2 reCaptcha)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            this._settings = settings;

            if (reCaptcha == null)
            {
                throw new ArgumentNullException("reCaptcha");
            }

            this._reCaptcha = reCaptcha;
        }
 public void Init()
 {
     this._settings = ReCaptchaV2Settings.CreateInstance();
 }