예제 #1
0
        private void AddUser(User user, IEnumerable <User> follows)
        {
            CreateOrGetUserFeed(user);

            foreach (var follow in follows)
            {
                UserFeed userFeed = CreateOrGetUserFeed(follow);
                userFeed.AddFollower(user);
            }
        }
예제 #2
0
        private void AddTweet(Tweet tweet)
        {
            if (tweet == null)
            {
                throw new ArgumentNullException("tweet");
            }

            UserFeed userFeed = CreateOrGetUserFeed(tweet.Creator);

            userFeed.AddTweet(tweet);

            foreach (var follower in userFeed.FollowedBy)
            {
                UserFeed followerFeed = CreateOrGetUserFeed(follower);
                followerFeed.AddTweet(tweet);
            }
        }