public void Display_Comment_Count_Test() { IEnumerable<Comment> cmnt = new List<Comment> { new Comment { CommentId =1, UpdateId = 1,CommentText="x"}, new Comment { CommentId =2, UpdateId = 1,CommentText="y"}, new Comment { CommentId =3, UpdateId = 1,CommentText="z"}, }.AsEnumerable(); commentRepository.Setup(x => x.GetMany(It.IsAny<Expression<Func<Comment, bool>>>())).Returns(cmnt); GoalController controller = new GoalController(goalService, metricService, focusService, supportService, updateService, commentService, userService, securityTokenService, supportInvitationService, goalStatusService, commentUserService, updateSupportService); JsonResult count = controller.DisplayCommentCount(1) as JsonResult; Assert.IsNotNull(count); Assert.AreEqual(3, count.Data); }