public async Task GetAllCommentsOfPost() { _mockComments.Setup(m => m.FindAsync(It.IsAny <Expression <Func <Comment, bool> > >())) .Returns((Expression <Func <Comment, bool> > predicate) => Task.FromResult(new List <Comment>() { new Comment(), new Comment() }.AsEnumerable())); var commentsOfPost = await _manager.GetCommentsOfPostAsync(1); Assert.AreEqual(commentsOfPost.Count(), 2); }
public async Task <IHttpActionResult> GetCommentsOfPost(int postId) { var comments = await _appService.GetCommentsOfPostAsync(postId); return(Ok(comments)); }