public void UserShouldBeAbleToCommentOnAProfile() { var user1 = new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1")); var user2 = new User(new LoginId("*****@*****.**"), new Name("firstName2", "lastName2")) { Profile = new Profile("This is the profile on which user1 will comment") }; var comment = new Comment(user1, user2, "This is what I am going to comment"); Assert.AreEqual(comment.Commentor, user1); Assert.AreEqual(comment.CommentedOn, user2); Assert.AreEqual(comment, user2.GetLatestProfileComment()); }
public void InboxShouldShowOnlyProfileCommentsWhenNotSubscribedToAnyGroup() { var Suchit = new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1")); var Vivek = new User(new LoginId("*****@*****.**"), new Name("firstName2", "lastName2")) { Profile = new Profile("This is the profile on which user1 will comment") }; var comment = new Comment(Suchit, Vivek, "This is what I am going to comment"); var comment2 = new Comment(Suchit, Vivek, "This is a second comment"); Inbox inbox = Vivek.GetInbox(); Assert.AreEqual(comment.Content, inbox.nextMessage().MessageContent); Assert.AreEqual(comment2.Content, inbox.nextMessage().MessageContent); }
public void InboxShouldShowMessagesInDescendingOrder() { var Suchit = new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1")); var Vivek = new User(new LoginId("*****@*****.**"), new Name("firstName2", "lastName2")) { Profile = new Profile("This is the profile on which user1 will comment") }; var oldComment = new Comment(Suchit, Vivek, "This is what I am going to comment", new GetInDate(new DateTime(2010,7,29))); var latestComment = new Comment(Suchit, Vivek, "This is a second comment", new GetInDate(new DateTime(2010,7,30))); Inbox inbox = Vivek.GetInbox(); Assert.AreEqual(latestComment.Content, inbox.nextMessage().MessageContent); Assert.AreEqual(oldComment.Content, inbox.nextMessage().MessageContent); }
public void InboxShouldShowBothCommentsAndMessagesInDescindingOrderOfDate() { var suchit = new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1")); var vivek = new User(new LoginId("*****@*****.**"), new Name("firstName2", "lastName2")) { Profile = new Profile("This is the profile on which user1 will comment") }; var commentOn5Oct = new Comment(suchit, vivek, "This is what I am going to comment", new GetInDate(new DateTime(2010,10,5))); var commentOn15Oct = new Comment(suchit, vivek, "This is a second comment", new GetInDate(new DateTime(2010,10,15))); var group = new Group("group1"); var postOn8Oct = new Post { Content = "content 1 for group1", PostedDateTime = new DateTime(2010, 10, 8) }; var postOn10Oct = new Post { Content = "content 2 for group1", PostedDateTime = new DateTime(2010, 10, 10) }; var groupPosts = new GroupPosts { groupPostList = new List<Post>() {postOn8Oct, postOn10Oct} }; group.MessageList = groupPosts; vivek.Groups.Add(group); vivek.PostToGroup(group,postOn8Oct); vivek.PostToGroup(group,postOn10Oct); Inbox inbox = vivek.GetInbox(); Assert.AreEqual(4, inbox.TotalMessageCount()); Assert.AreEqual(commentOn15Oct.Content, inbox.nextMessage().MessageContent); Assert.AreEqual(postOn10Oct.Content, inbox.nextMessage().MessageContent); Assert.AreEqual(postOn8Oct.Content, inbox.nextMessage().MessageContent); Assert.AreEqual(commentOn5Oct.Content, inbox.nextMessage().MessageContent); }
public void Add(Comment comment) { List.Add(comment); }
public virtual void AddCommentToProfile(Comment comment) { UserProfileComments.Add(comment); }
public Message(Comment comment) { messageContent = comment.Content; type = "comment"; sender = comment.Commentor; sentOn = comment.CommentDate.Value; }