public void DisplayCommentCount() { IEnumerable<GroupComment> cmnt = new List<GroupComment> { new GroupComment { GroupCommentId =1, GroupUpdateId = 1,CommentText="x"}, new GroupComment { GroupCommentId =2, GroupUpdateId = 1,CommentText="y"}, new GroupComment { GroupCommentId =3, GroupUpdateId = 1,CommentText="z"}, }.AsEnumerable(); groupCommentRepository.Setup(x => x.GetMany(It.IsAny<Expression<Func<GroupComment, bool>>>())).Returns(cmnt); GroupController controller = new GroupController(groupService, groupUserService, userService, metricService, focusService, groupgoalService, groupInvitationService, securityTokenService, groupUpdateService, groupCommentService, goalStatusService, groupRequestService, followUserService, groupCommentUserService, groupUpdateSupportService, groupUpdateUserService); JsonResult count = controller.DisplayCommentCount(1) as JsonResult; Assert.IsNotNull(count); Assert.AreEqual(3, count.Data); }