public void CreateStickyPostTest() { TransitPost t_post1 = new TransitPost(); t_post1.Body = Guid.NewGuid().ToString(); t_post1.Title = Guid.NewGuid().ToString(); t_post1.Publish = true; t_post1.Sticky = true; t_post1.Created = t_post1.Modified = DateTime.UtcNow; t_post1.Id = Blog.CreateOrUpdatePost(Ticket, t_post1); Assert.Greater(t_post1.Id, 0); Thread.Sleep(1000); TransitPost t_post2 = new TransitPost(); t_post2.Body = Guid.NewGuid().ToString(); t_post2.Title = Guid.NewGuid().ToString(); t_post2.Publish = true; t_post2.Sticky = false; t_post2.Created = t_post2.Modified = DateTime.UtcNow; t_post2.Id = Blog.CreateOrUpdatePost(Ticket, t_post2); Assert.Greater(t_post1.Id, 0); TransitPostQueryOptions queryOptions = new TransitPostQueryOptions(); queryOptions.PageNumber = 0; queryOptions.PageSize = 2; queryOptions.DateStart = DateTime.MinValue; queryOptions.DateEnd = DateTime.MaxValue; queryOptions.SortDirection = WebServiceQuerySortDirection.Descending; queryOptions.SortExpression = "Created"; TransitPost[] posts = Blog.GetPosts(Ticket, queryOptions); Blog.DeletePost(Ticket, t_post1.Id); Blog.DeletePost(Ticket, t_post2.Id); Assert.AreEqual(2, posts.Length); // make sure the sticky post is on top (the second post might not be in second position if there're other stick posts) Assert.AreEqual(t_post1.Id, posts[0].Id); }
/// <remarks/> public void GetPostsExAsync(string ticket, TransitPostQueryOptions options, object userState) { if ((this.GetPostsExOperationCompleted == null)) { this.GetPostsExOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetPostsExOperationCompleted); } this.InvokeAsync("GetPostsEx", new object[] { ticket, options}, this.GetPostsExOperationCompleted, userState); }
public TransitPost[] GetPostsEx(string ticket, TransitPostQueryOptions options) { object[] results = this.Invoke("GetPostsEx", new object[] { ticket, options}); return ((TransitPost[])(results[0])); }
/// <remarks/> public void GetPostsExAsync(string ticket, TransitPostQueryOptions options) { this.GetPostsExAsync(ticket, options, null); }
public int GetPostsCount(string ticket, TransitPostQueryOptions options) { object[] results = this.Invoke("GetPostsCount", new object[] { ticket, options}); return ((int)(results[0])); }