public void DeleteCommentSuccess() { int id = CommentDB.GetCommentsByPostId(active, 1)[0].Id; int oldNumberOfCommentsByPostId = CommentDB.GetCommentsByPostId(active, 1).Count; CommentDB.DeleteComment(id); int newNumberOfCommentsByPostId = CommentDB.GetCommentsByPostId(active, 1).Count; Assert.AreEqual(oldNumberOfCommentsByPostId - 1, newNumberOfCommentsByPostId); }
public void DeleteCommentFailed() { int id = 100; int oldNumberOfCommentsByPostId = CommentDB.GetCommentsByPostId(active, 1).Count; CommentDB.DeleteComment(id); int newNumberOfCommentsByPostId = CommentDB.GetCommentsByPostId(active, 1).Count; Assert.AreEqual(oldNumberOfCommentsByPostId, newNumberOfCommentsByPostId); }
public void DeleteCommentFailed() { Guid id = Guid.NewGuid(); int oldNumberOfCommentsByPostId = CommentDB.GetCommentsByPostId(active, post_id).Count; CommentDB.DeleteComment(id); int newNumberOfCommentsByPostId = CommentDB.GetCommentsByPostId(active, post_id).Count; Assert.AreEqual(oldNumberOfCommentsByPostId, newNumberOfCommentsByPostId); }
public void UpdateCommentSuccess() { Guid id = CommentDB.GetCommentsByPostId(active, post_id)[0].Id; Comment comment = new Comment { TextComment = "updated text comment", UserId = "user_1", PostId = "post_1", Active = true }; Comment updatedComment = CommentDB.UpdateComment(comment, id); Assert.AreEqual(comment.TextComment, updatedComment.TextComment); }
public void UpdateCommentFailed() { Guid id = CommentDB.GetCommentsByPostId(active, post_id)[0].Id; Comment comment = new Comment { TextComment = "", UserId = "user_1", PostId = "post_1", Active = true }; Comment updatedComment = CommentDB.UpdateComment(comment, id); Assert.IsNull(updatedComment); }
public void UpdateCommentFailed() { int id = CommentDB.GetCommentsByPostId(active, 3)[0].Id; Comment comment = new Comment { Text = "", Date = new DateTime(2018, 2, 1, 5, 0, 0), Attachment = Encoding.ASCII.GetBytes("dodatak"), PostId = 3, UserId = 2, Active = true }; Comment updatedComment = CommentDB.UpdateComment(comment, id); Assert.IsNull(updatedComment); }
public void UpdateCommentSuccess() { int id = CommentDB.GetCommentsByPostId(active, 3)[0].Id; Comment comment = new Comment { Text = "UPDATE", Date = new DateTime(2018, 2, 1, 5, 0, 0), Attachment = Encoding.ASCII.GetBytes("dodatak"), PostId = 3, UserId = 2, Active = true }; Comment updatedComment = CommentDB.UpdateComment(comment, id); Assert.AreEqual(comment.Text, updatedComment.Text); }
public IEnumerable <Comment> GetCommentsByPostId(int id, [FromUri] ActiveStatusEnum active = ActiveStatusEnum.Active) { return(CommentDB.GetCommentsByPostId(active, id)); }
public void GetCommentSuccess() { int id = CommentDB.GetCommentsByPostId(active, 3)[0].Id; Assert.IsNotNull(CommentDB.GetComment(id)); }
public void GetCommentsByPostIdFailed() { Assert.IsEmpty(CommentDB.GetCommentsByPostId(active, 100)); }
public void GetCommentsByPostIdSuccess() { Assert.AreEqual(CommentDB.GetCommentsByPostId(active, 3).Count, 4); }
public void GetCommentsByPostIdFailed() { Assert.IsEmpty(CommentDB.GetCommentsByPostId(active, "postIdThatNotExists")); }