Beispiel #1
0
 public void Setup() {
     var mongoToken = Token.ReadFromRessource(GetType().Assembly, "twitter.tweetstore.tests.mongohq.credentials.txt");
     sut = new TweetStore(mongoToken);
 }
Beispiel #2
0
        public static TweetStore MapStreamedTweetToTweetDomain(ITweet streamedTweet, string searchPhrase)
        {
            TweetStore tweetDomain = new TweetStore();

            if (streamedTweet == null)
            {
                throw new ArgumentNullException("ITweet is null");
            }


            tweetDomain = new TweetStore();

            tweetDomain.SearchPhrase = searchPhrase;

            if (streamedTweet.Creator != null)
            {
                tweetDomain.CreatorName = streamedTweet.Creator.Name;
            }

            if (streamedTweet.TweetDTO != null)
            {
                tweetDomain.Id                   = streamedTweet.TweetDTO.Id;
                tweetDomain.IdStr                = streamedTweet.TweetDTO.IdStr;
                tweetDomain.Text                 = streamedTweet.TweetDTO.Text;
                tweetDomain.Favorited            = streamedTweet.TweetDTO.Favorited;
                tweetDomain.CreatedAt            = streamedTweet.CreatedAt;
                tweetDomain.Truncated            = streamedTweet.Truncated;
                tweetDomain.InReplyToStatusId    = streamedTweet.InReplyToStatusId;
                tweetDomain.InReplyToStatusIdStr = streamedTweet.InReplyToStatusIdStr;
                tweetDomain.InReplyToUserId      = streamedTweet.InReplyToUserId;
                tweetDomain.InReplyToUserIdStr   = streamedTweet.InReplyToUserIdStr;
                tweetDomain.InReplyToScreenName  = streamedTweet.InReplyToScreenName;
                tweetDomain.RetweetCount         = streamedTweet.RetweetCount;
                tweetDomain.Retweeted            = streamedTweet.Retweeted;

                if (streamedTweet.TweetDTO.Creator != null)
                {
                    tweetDomain.Description                    = streamedTweet.TweetDTO.Creator.Description;
                    tweetDomain.Location                       = streamedTweet.TweetDTO.Creator.Location;
                    tweetDomain.GeoEnabled                     = streamedTweet.TweetDTO.Creator.GeoEnabled;
                    tweetDomain.Url                            = streamedTweet.TweetDTO.Creator.Url;
                    tweetDomain.StatusesCount                  = streamedTweet.TweetDTO.Creator.StatusesCount;
                    tweetDomain.FollowersCount                 = streamedTweet.TweetDTO.Creator.FollowersCount;
                    tweetDomain.FriendsCount                   = streamedTweet.TweetDTO.Creator.FriendsCount;
                    tweetDomain.Following                      = streamedTweet.TweetDTO.Creator.Following;
                    tweetDomain.Protected                      = streamedTweet.TweetDTO.Creator.Protected;
                    tweetDomain.Verified                       = streamedTweet.TweetDTO.Creator.Verified;
                    tweetDomain.Notifications                  = streamedTweet.TweetDTO.Creator.Notifications;
                    tweetDomain.ProfileImageUrl                = streamedTweet.TweetDTO.Creator.ProfileImageUrl;
                    tweetDomain.ProfileImageUrlHttps           = streamedTweet.TweetDTO.Creator.ProfileImageUrlHttps;
                    tweetDomain.FollowRequestSent              = streamedTweet.TweetDTO.Creator.FollowRequestSent;
                    tweetDomain.DefaultProfile                 = streamedTweet.TweetDTO.Creator.DefaultProfile;
                    tweetDomain.DefaultProfileImage            = streamedTweet.TweetDTO.Creator.DefaultProfileImage;
                    tweetDomain.FavouritesCount                = streamedTweet.TweetDTO.Creator.FavouritesCount;
                    tweetDomain.ListedCount                    = streamedTweet.TweetDTO.Creator.ListedCount;
                    tweetDomain.ProfileSidebarFillColor        = streamedTweet.TweetDTO.Creator.ProfileSidebarFillColor;
                    tweetDomain.ProfileSidebarBorderColor      = streamedTweet.TweetDTO.Creator.ProfileSidebarBorderColor;
                    tweetDomain.ProfileBackgroundTitle         = streamedTweet.TweetDTO.Creator.ProfileBackgroundTitle;
                    tweetDomain.ProfileBackgroundColor         = streamedTweet.TweetDTO.Creator.ProfileBackgroundColor;
                    tweetDomain.ProfileBackgroundImageUrl      = streamedTweet.TweetDTO.Creator.ProfileBackgroundImageUrl;
                    tweetDomain.ProfileBackgroundImageUrlHttps = streamedTweet.TweetDTO.Creator.ProfileBackgroundImageUrlHttps;
                    tweetDomain.ProfileTextColor               = streamedTweet.TweetDTO.Creator.ProfileTextColor;
                    tweetDomain.ProfileLinkColor               = streamedTweet.TweetDTO.Creator.ProfileLinkColor;
                    tweetDomain.ProfileUseBackgroundImage      = streamedTweet.TweetDTO.Creator.ProfileUseBackgroundImage;
                    tweetDomain.IsTranslator                   = streamedTweet.TweetDTO.Creator.IsTranslator;
                    tweetDomain.ShowAllInlineMedia             = streamedTweet.TweetDTO.Creator.ShowAllInlineMedia;
                    tweetDomain.ContributorsEnabled            = streamedTweet.TweetDTO.Creator.ContributorsEnabled;
                    tweetDomain.UtcOffset                      = streamedTweet.TweetDTO.Creator.UtcOffset;
                    tweetDomain.TimeZone                       = streamedTweet.TweetDTO.Creator.TimeZone;
                }

                if (streamedTweet.TweetDTO.Coordinates != null)
                {
                    tweetDomain.Longitude = streamedTweet.TweetDTO.Coordinates.Longitude;
                    tweetDomain.Latitude  = streamedTweet.TweetDTO.Coordinates.Latitude;
                }
            }



            return(tweetDomain);
        }