Exemplo n.º 1
0
        public void GivenAUserWallWhenPostIsCalledThenItTimestampsTheMessage()
        {
            var userWall = new UserWall();
            var bob      = new User(BobUserHandle, userWall);

            userWall.Post(bob, PostMessageText);

            userWall.Posts(bob).Should().Contain(m => m.Timestamp == SystemTime.Now());
        }
Exemplo n.º 2
0
        public void GivenAUserWallWhenPostIsCalledThenItSavesThePostMessage()
        {
            var userWall = new UserWall();
            var bob      = new User(BobUserHandle, userWall);

            userWall.Post(bob, PostMessageText);

            userWall.Posts(bob).Should().Contain(m => m.Body == PostMessageText);
        }
        public void Setup()
        {
            SystemTime.Now = () => new DateTime(2000, 1, 1);

            var userWall = new UserWall();
            var bob      = new User(BobUserHandle, userWall);

            this.message  = new Message(bob, PostMessageText);
            this.formater = new WallMessageFormater(new MessageFormater(new ElapsedTimeMessageFormater()));
        }
        public void Setup()
        {
            SystemTime.Now = () => new DateTime(2000, 1, 1);

            var userWall = new UserWall();
            var bob      = new User("Bob", userWall);

            this.message  = new Message(bob, "Bob's message");
            this.formater = new ElapsedTimeMessageFormater();
        }
Exemplo n.º 5
0
        public void GivenAUserWallWhenPostsIsCalledThenItFiltersPostsForSpecifiedUser()
        {
            var userWall = new UserWall();
            var bob      = new User(BobUserHandle, userWall);
            var alice    = new User(AliceUserHandle, userWall);

            userWall.Post(bob, string.Format("{0} {1}", BobUserHandle, PostMessageText));
            userWall.Post(alice, string.Format("{0} {1}", AliceUserHandle, PostMessageText));

            userWall.Posts(bob).Should().OnlyContain(m => m.Body == string.Format("{0} {1}", BobUserHandle, PostMessageText));
        }
 public void fetchPosts()
 {
     try
     {
         List <WallPost> Posts = r_FbUser.Get("me/feed?fields=message,likes{name},comments{from},story,source,created_time,picture,from&limit=10000") as List <WallPost>;
         m_AllPostsAmount  = Posts.Count;
         m_UserWallbyDate  = new UserWall(Posts, new WallSortByDate());
         m_UserWallbyLikes = new UserWall(Posts, new WallSortByLikes());
         setFeed(m_UserWallbyDate);
     }
     catch (Exception exp)
     {
         Console.WriteLine(exp.ToString());
     }
 }
        private void setFeed(UserWall i_UserWall)
        {
            int likeAmountToDisplay = int.Parse(comboBoxAmountOfLikesToFilter.SelectedItem.ToString());

            i_UserWall.Filter = wallPost => wallPost.LikeCount >= likeAmountToDisplay;

            IEnumerator <WallPost> userWallEnumerator = i_UserWall.GetEnumerator();

            flowLayoutPanel.Controls.Clear();

            int amountOfPostsIndex = 0;

            while (userWallEnumerator.MoveNext() && amountOfPostsIndex < m_PostsAmountToDisplay)
            {
                flowLayoutPanel.Controls.Add(new UserControlPost(userWallEnumerator.Current));
                amountOfPostsIndex++;
            }
        }