예제 #1
0
 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());
 }
예제 #2
0
파일: UserTest.cs 프로젝트: bagheera/getin
        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);
        }
예제 #3
0
파일: UserTest.cs 프로젝트: bagheera/getin
        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);
        }
예제 #4
0
파일: UserTest.cs 프로젝트: bagheera/getin
        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);
        }
예제 #5
0
파일: User.cs 프로젝트: bagheera/getin
 public void Add(Comment comment)
 {
     List.Add(comment);
 }
예제 #6
0
파일: User.cs 프로젝트: bagheera/getin
 public virtual void AddCommentToProfile(Comment comment)
 {
     UserProfileComments.Add(comment);
 }
예제 #7
0
파일: User.cs 프로젝트: bagheera/getin
 public Message(Comment comment)
 {
     messageContent = comment.Content;
     type = "comment";
     sender = comment.Commentor;
     sentOn = comment.CommentDate.Value;
 }