public async Task TestRetrivePost(ApiConfig config) { var pc = new PostController(config); var fc = new ForumController(config); var forums = await fc.GetForumsAsync(); var posts = await pc.GetPostAsync(forums.First().Id, 1); foreach (var item in posts) { Assert.IsInstanceOfType(item, typeof(Post)); } }
public async Task RetriveReplyTest(ApiConfig config) { var pc = new PostController(config); var fc = new ForumController(config); var forums = await fc.GetForumsAsync(); var posts = await pc.GetPostAsync(forums.First().Id, 1); var post = posts.FirstOrDefault(p => p.Hr + p.Replys.Count > 0); if (post != null) { var rc = new ReplyController(config); var reply = await rc.GetReplyAsync(post.No); Assert.IsInstanceOfType(reply, typeof(Reply)); } }
public async Task ThreadRetriveTest(ApiConfig config) { var pc = new PostController(config); var fc = new ForumController(config); var forums = await fc.GetForumsAsync(); var posts = await pc.GetPostAsync(forums.First().Id, 1); var post = posts.FirstOrDefault(p => p.Hr + p.Replys.Count > 0); if (post != null) { var tc = new ThreadController(config); var threads = await tc.GetThreadsAsync(post.No, 1); foreach (var item in threads) { Assert.IsInstanceOfType(item, typeof(Thread)); } } }
public async Task <IEnumerable <PostViewModel> > GetPagedItemsAsync(int pageIndex, int pageSize, CancellationToken cancellationToken = default) { var posts = await _postController.GetPostAsync(_forum.ID, pageIndex + 1); return(posts.Select(i => new PostViewModel(i, _config))); }