コード例 #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);
            }
        }