public void Api_Key_Should_Be_Valid()
        {
            _httpForm.Setup(h => h.Post(It.IsAny <HttpFormPostRequest>())).Returns(new HttpFormResponse {
                Response = ValidApiKeyResponse
            });
            _httpForm.Setup(h => h.Post(It.Is <HttpFormPostRequest>(r => r.Url == CommentCheckUrl))).Returns(new HttpFormResponse {
                Response = "false"
            });

            Assert.DoesNotThrow(() => _spamProtection.IsSpam(CreateDummyContent()));
        }
Esempio n. 2
0
        public void Api_Key_Should_Be_Valid()
        {
            _httpForm.Expect(h => h.Post(ApiKeyCheckUrl, It.IsAny <NameValueCollection>())).Returns(ValidApiKeyResponse);
            _httpForm.Expect(h => h.Post(CommentCheckUrl, It.IsAny <NameValueCollection>())).Returns("true");

            Assert.DoesNotThrow(() => _spamProtection.IsSpam(CreateDummyContent()));
        }