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 InboxShouldShowOnlyFirstTwentyFiveProfileCommentsWhenNotSubscribedToAnyGroup() { 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") }; string sampleComment = "some comment "; for (int i = 0; i < 50; i++){ new Comment(Suchit, Vivek, sampleComment + i, new GetInDate(new DateTime(i))); } Inbox inbox = Vivek.GetInbox(); Assert.AreEqual(25, inbox.TotalMessageCount()); for (int i = 49; i >= 25; i--){ Assert.AreEqual(sampleComment + i, 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); }