Exemple #1
1
        public async Task CheckComment_Spam()
        {
            var key = ConfigurationManager.AppSettings["apiKey"];
            var akismet = new Akismet(key, new Uri("http://www.mysite.com"), ApplicationName);
            Assert.True(await akismet.VerifyKeyAsync());

            var comment = akismet.CreateComment();
            comment.UserIp = "127.0.0.1";
            comment.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1";
            comment.Referrer = "http://www.google.com";
            comment.Permalink = "/blog/post_one";
            comment.CommentType = CommentTypes.Comment;
            comment.CommentAuthor = "nike air max bw";
            comment.CommentAuthorEmail = "";
            comment.CommentAuthorUrl = "http://forum.fxdteam.com/profile/RetaWerth";
            comment.CommentContent = "Howdy! I simply would like to offer you a big thumbs up for your excellent info you have here on this post. I will be returning to your site for more soon.";

            var result = await akismet.CheckCommentAsync(comment);

            Assert.Equal(CommentCheck.Spam, result);
        }