public void AddCommentAndFindCommentsTest() { UserProfileDetails userProfileDetails = new UserProfileDetails("first name", "last name", "*****@*****.**", "es", "ES"); long userId = userService.RegisterUser("user1", "password", userProfileDetails); long newCommentId = sportEventService.AddComment("user1", 1, "description", null); DTOComment expectedComment = new DTOComment(newCommentId, "user1", 1, "description", DateTime.Now.Date, null); List <DTOComment> obtainedComments = sportEventService.FindComments(1, 0, 1); int numberOfComments = obtainedComments.Count(); bool commentExist = commentDao.Exists(newCommentId); Assert.IsTrue(commentExist); Assert.AreEqual(1, numberOfComments); foreach (var comment in obtainedComments) { Assert.AreEqual(expectedComment.commentId, comment.commentId, "Comment found does not correspond with the original one."); Assert.AreEqual(expectedComment.comment_description, comment.comment_description, "Comment found does not correspond with the original one."); Assert.AreEqual(expectedComment.eventId, comment.eventId, "Comment found does not correspond with the original one."); Assert.AreEqual(expectedComment.loginName, comment.loginName, "Comment found does not correspond with the original one."); } }