Exemple #1
0
 private WebBlogService.TransitAccountBlogPostQueryOptions GetBlogPostQueryOptions()
 {
     WebBlogService.TransitAccountBlogPostQueryOptions qopt = new WebBlogService.TransitAccountBlogPostQueryOptions();
     qopt.PublishedOnly = false;
     qopt.BlogId        = _blog_id;
     return(qopt);
 }
Exemple #2
0
        public void MoveDiscussionPostToAccountBlogTest()
        {
            WebDiscussionServiceTests.DiscussionPostTest _post = new WebDiscussionServiceTests.DiscussionPostTest();
            _post.SetUp();
            int post_id = _post.Create(GetAdminTicket());

            Console.WriteLine("Post: {0}", post_id);
            // query options
            WebBlogService.TransitAccountBlogPostQueryOptions qopt = new WebBlogService.TransitAccountBlogPostQueryOptions();
            qopt.BlogId        = _blog_id;
            qopt.PublishedOnly = false;
            // make sure there're no posts in the blog
            int blog_posts_count = EndPoint.GetAccountBlogPostsCount(GetAdminTicket(), qopt);

            Assert.AreEqual(0, blog_posts_count);
            // move the discussion post
            int moved_post_id = EndPoint.MoveDiscussionPost(GetAdminTicket(), post_id, _blog_id);

            Console.WriteLine("Moved Post: {0}", moved_post_id);
            Assert.AreNotEqual(0, moved_post_id);
            int blog_posts_count2 = EndPoint.GetAccountBlogPostsCount(GetAdminTicket(), qopt);

            Assert.AreEqual(1, blog_posts_count2);
            _post.TearDown();
        }
Exemple #3
0
 public void AccountBlogPostStickynessTest()
 {
     // check that the system admin can create and flip the stickyness of the post
     // create a first post
     WebBlogService.TransitAccountBlogPost t_post = GetTransitInstance();
     t_post.Id = EndPoint.CreateOrUpdateAccountBlogPost(GetAdminTicket(), t_post);
     Console.WriteLine("Post: {0}", t_post.Id);
     // create a second post
     System.Threading.Thread.Sleep(1000);
     WebBlogService.TransitAccountBlogPost t_post2 = GetTransitInstance();
     t_post2.Id = EndPoint.CreateOrUpdateAccountBlogPost(GetAdminTicket(), t_post2);
     Console.WriteLine("Post: {0}", t_post2.Id);
     // query options
     WebBlogService.TransitAccountBlogPostQueryOptions qopt = new WebBlogService.TransitAccountBlogPostQueryOptions();
     qopt.BlogId        = _blog_id;
     qopt.PublishedOnly = false;
     // make sure these are in order
     WebBlogService.TransitAccountBlogPost[] posts = EndPoint.GetAccountBlogPosts(GetAdminTicket(), qopt, null);
     Assert.AreEqual(2, posts.Length);
     Assert.AreEqual(t_post.Id, posts[1].Id); // newest post first
     Assert.AreEqual(t_post2.Id, posts[0].Id);
     // flip stickiness of the first post
     WebBlogService.TransitAccountBlogPost t_post_copy = EndPoint.GetAccountBlogPostById(
         GetAdminTicket(), t_post.Id);
     Assert.AreEqual(t_post.Id, t_post_copy.Id);
     Assert.AreEqual(false, t_post_copy.Sticky);
     Assert.AreEqual(t_post.Sticky, t_post_copy.Sticky);
     t_post.Sticky = true;
     t_post.Id     = EndPoint.CreateOrUpdateAccountBlogPost(GetAdminTicket(), t_post);
     t_post_copy   = EndPoint.GetAccountBlogPostById(GetAdminTicket(), t_post.Id);
     Assert.AreEqual(t_post.Id, t_post_copy.Id);
     Assert.AreEqual(true, t_post_copy.Sticky);
     Assert.AreEqual(t_post.Sticky, t_post_copy.Sticky);
     // get posts, make sure the last one stuck
     WebBlogService.TransitAccountBlogPost[] posts_after = EndPoint.GetAccountBlogPosts(
         GetAdminTicket(), qopt, null);
     Assert.AreEqual(2, posts_after.Length);
     Assert.AreEqual(t_post2.Id, posts_after[1].Id); // newest post first
     Assert.AreEqual(t_post.Id, posts_after[0].Id);
     // reset stickyness
     t_post.Sticky = false;
     t_post.Id     = EndPoint.CreateOrUpdateAccountBlogPost(GetAdminTicket(), t_post);
     t_post_copy   = EndPoint.GetAccountBlogPostById(GetAdminTicket(), t_post.Id);
     Assert.AreEqual(t_post.Id, t_post_copy.Id);
     Assert.AreEqual(false, t_post_copy.Sticky);
     Assert.AreEqual(t_post.Sticky, t_post_copy.Sticky);
     // recheck after stickyness
     WebBlogService.TransitAccountBlogPost[] posts_final = EndPoint.GetAccountBlogPosts(
         GetAdminTicket(), qopt, null);
     Assert.AreEqual(2, posts_final.Length);
     Assert.AreEqual(t_post.Id, posts_final[1].Id); // newest post first
     Assert.AreEqual(t_post2.Id, posts_final[0].Id);
     // delete everything
     EndPoint.DeleteAccountBlogPost(GetAdminTicket(), t_post.Id);
     EndPoint.DeleteAccountBlogPost(GetAdminTicket(), t_post2.Id);
 }