public static void CheckCommentIsOrIsNotInTheCommentList(DnaTestURLRequest request, bool isInList, string textToCheck, CommentForum commentForum) { CallGETCommentForumAPIRequest(request, "h2g2", commentForum.Id); var currentCommentForum = (CommentForum)request.GetLastResponseAsJSONObject(typeof(CommentForum)); bool match = false; Console.WriteLine("Text just posted : " + textToCheck); foreach (CommentInfo comment in currentCommentForum.commentList.comments) { match |= textToCheck.CompareTo(comment.text) == 0; Console.WriteLine("Comment in list : " + comment.text); } Console.WriteLine("Post found in comment list : " + match); if (isInList) { Assert.IsTrue(match); } else { Assert.IsFalse(match); } }