示例#1
0
        public sealed override void DoTest(Blog blog, IBlogClient blogClient, ITestResults results)
        {
            BlogPost blogPost = new BlogPost();
            bool?    publish  = null;

            PreparePost(blogPost, ref publish);

            string token = BlogUtil.ShortGuid;

            blogPost.Title = token + ":" + blogPost.Title;

            string      etag;
            XmlDocument remotePost;
            string      postId = blogClient.NewPost(blog.BlogId, blogPost, null, publish ?? true, out etag, out remotePost);

            try
            {
                RetryUntilTimeout(TimeoutDuration, delegate
                {
                    using (HttpWebResponse response = HttpRequestHelper.SendRequest(blog.HomepageUrl))
                    {
                        using (Stream stream = response.GetResponseStream())
                        {
                            string html = Encoding.ASCII.GetString(StreamHelper.AsBytes(stream));

                            if (html.Contains(token))
                            {
                                HandleResult(html, results);
                                return(true);
                            }

                            Thread.Sleep(1000);
                            return(false);
                        }
                    }
                });
            }
            catch (TimeoutException te)
            {
                if (!HandleTimeout(te, results))
                {
                    throw;
                }
            }

            if (postId != null && CleanUpPosts)
            {
                blogClient.DeletePost(blog.BlogId, postId, false);
            }
        }
示例#2
0
        public sealed override void DoTest(Blog blog, IBlogClient blogClient, ITestResults results)
        {
            BlogPost blogPost = new BlogPost();
            bool?    publish  = null;

            PreparePost(blog, blogClient, blogPost, ref publish);

            string token = BlogUtil.ShortGuid;

            blogPost.Title = token + ":" + blogPost.Title;

            string      etag;
            XmlDocument remotePost;
            string      postId  = blogClient.NewPost(blog.BlogId, blogPost, null, publish ?? true, out etag, out remotePost);
            BlogPost    newPost = blogClient.GetPost(blog.BlogId, postId);

            HandleResult(newPost, results);
            if (postId != null && CleanUpPosts)
            {
                blogClient.DeletePost(blog.BlogId, postId, false);
            }
        }
示例#3
0
        public sealed override void DoTest(Blog blog, IBlogClient blogClient, ITestResults results)
        {
            BlogPost blogPost = new BlogPost();
            bool? publish = null;
            PreparePost(blogPost, ref publish);

            string token = BlogUtil.ShortGuid;
            blogPost.Title = token + ":" + blogPost.Title;

            string etag;
            XmlDocument remotePost;
            string postId = blogClient.NewPost(blog.BlogId, blogPost, null, publish ?? true, out etag, out remotePost);

            try
            {
                RetryUntilTimeout(TimeoutDuration, delegate
                {
                    using (HttpWebResponse response = HttpRequestHelper.SendRequest(blog.HomepageUrl))
                    {
                        using (Stream stream = response.GetResponseStream())
                        {
                            string html = Encoding.ASCII.GetString(StreamHelper.AsBytes(stream));

                            if (html.Contains(token))
                            {
                                HandleResult(html, results);
                                return true;
                            }

                            Thread.Sleep(1000);
                            return false;
                        }
                    }
                });
            }
            catch (TimeoutException te)
            {
                if (!HandleTimeout(te, results))
                    throw;
            }

            if (postId != null && CleanUpPosts)
                blogClient.DeletePost(blog.BlogId, postId, false);
        }
示例#4
0
        public sealed override void DoTest(Blog blog, IBlogClient blogClient, ITestResults results)
        {
            BlogPost blogPost = new BlogPost();
            bool? publish = null;
            PreparePost(blog, blogClient, blogPost, ref publish);

            string token = BlogUtil.ShortGuid;
            blogPost.Title = token + ":" + blogPost.Title;

            string etag;
            XmlDocument remotePost;
            string postId = blogClient.NewPost(blog.BlogId, blogPost, null, publish ?? true, out etag, out remotePost);
            BlogPost newPost = blogClient.GetPost(blog.BlogId, postId);
            HandleResult(newPost, results);
            if (postId != null && CleanUpPosts)
                blogClient.DeletePost(blog.BlogId, postId, false);
        }