public void CommentsComponent_AddComment() { var commentsComponent = new CommentsComponent(); var user = FakeObjects.TestUserWithId(); var createdDateTime = DateTime.UtcNow; commentsComponent.AddComment( FakeValues.Message, user, createdDateTime ); Assert.IsTrue(commentsComponent.Comments.ToList().Count == 1); Assert.AreEqual(commentsComponent.Comments.ToList()[0].Message, FakeValues.Message); Assert.AreEqual(commentsComponent.Comments.ToList()[0].User, user.DenormalisedUserReference()); Assert.AreEqual(commentsComponent.Comments.ToList()[0].Id, "1"); }
public void CommentsComponent_RemoveComment() { var commentsComponent = new CommentsComponent(); var user = FakeObjects.TestUserWithId(); var createdDateTime = DateTime.UtcNow; commentsComponent.AddComment( FakeValues.Message, user, createdDateTime ); Assert.IsTrue(commentsComponent.Comments.ToList().Count == 1); commentsComponent.RemoveComment(commentsComponent.Comments.ToList()[0].Id); Assert.IsTrue(commentsComponent.Comments.ToList().Count == 0); }
public void CommentsComponent_UpdateComment() { var commentsComponent = new CommentsComponent(); var user = FakeObjects.TestUserWithId(); var createdDateTime = DateTime.UtcNow.AddDays(-1); var modifiedDateTime = DateTime.UtcNow; commentsComponent.AddComment( FakeValues.Message, user, createdDateTime ); commentsComponent.UpdateComment( commentsComponent.Comments.ToList()[0].Id, FakeValues.Message.AppendWith("new"), user, modifiedDateTime ); Assert.AreEqual(commentsComponent.Comments.ToList()[0].Message, FakeValues.Message.AppendWith("new")); Assert.AreEqual(commentsComponent.Comments.ToList()[0].EditedOn, modifiedDateTime); }