public void CanANewCommentBeCreated() { Comment a = new Comment() { commentid = 99, shorttext = "Some image from test", body = "Some Name from test", userid = 1, contentid = 1 }; _testRepo.Add(a); var insertedComment = _testRepo.FindAll().Where(w => w.shorttext == a.shorttext).First(); Assert.AreEqual(a.shorttext, insertedComment.shorttext); }
void AddCommentToPost() { PrintPosts(); int id = 0; Console.WriteLine("Please enter the id for which you want to comment"); id = Convert.ToInt32(Console.ReadLine()); Post post = postRepo.Get(id); if (post != null) { PrintPost(post); Comment comment = TakeComment(id); if (commentRepo.Add(comment)) { Console.WriteLine("comment updated"); } } }
public void AddComment([FromBody] Comment data) { CommentRepo.Add(data); _log.LogInformation($"The Comment that is added {JsonConvert.SerializeObject(data)}"); }