예제 #1
0
        public void Convert_WithTwoTwitterStatuses_ShouldReturnTwoResults()
        {
            List <TwitterStatus> twitterStatuses = Builder <TwitterStatus>
                                                   .CreateListOfSize(2)
                                                   .WhereAll()
                                                   .Have(ts => ts.User = Builder <TwitterUser> .CreateNew().Build())
                                                   .Build()
                                                   .ToList();

            IEnumerable <NGTweeterStatus> result = _tweeterStatusAdapter.Convert(twitterStatuses);

            Assert.AreEqual(2, result.Count());

            VerifyListResults(result.ToList(), twitterStatuses);
        }
예제 #2
0
        public GetTweetResponse GetTweetsOnPublicTimeline()
        {
            TwitterService service             = new TwitterService();
            IEnumerable <TwitterStatus> tweets = service.ListTweetsOnPublicTimeline();

            TweeterStatusAdapter adapter = new TweeterStatusAdapter();

            return(new GetTweetResponse {
                TweeterStatuses = adapter.Convert(tweets)
            });
        }
예제 #3
0
        public GetTweetResponse GetTweetsMentioningMe(OAuthAccessToken access)
        {
            _twitterService.AuthenticateWith(access.Token, access.TokenSecret);

            IEnumerable <TwitterStatus> tweets = _twitterService.ListTweetsMentioningMe();

            TweeterStatusAdapter adapter = new TweeterStatusAdapter();

            return(new GetTweetResponse {
                TweeterStatuses = adapter.Convert(tweets)
            });
        }
예제 #4
0
        public GetTweetResponse GetTweets(OAuthAccessToken access)
        {
            _twitterService.AuthenticateWith(access.Token, access.TokenSecret);

            IEnumerable <TwitterStatus> tweets = _twitterService.ListTweetsOnHomeTimeline(INITIAL_TWEETS_COUNT);

            TweeterStatusAdapter adapter = new TweeterStatusAdapter();

            return(new GetTweetResponse {
                TweeterStatuses = adapter.Convert(tweets)
            });
        }
예제 #5
0
        public SendTweetResponse SendTweet(SendTweetRequest request)
        {
            _twitterService.AuthenticateWith(request.AccessToken.Token, request.AccessToken.TokenSecret);

            TwitterStatus twitterStatus = _twitterService.SendTweet(request.Status);

            TweeterStatusAdapter tweeterStatusAdapter = new TweeterStatusAdapter();

            SendTweetResponse response = new SendTweetResponse {
                TweeterStatus = tweeterStatusAdapter.Convert(twitterStatus)
            };

            return(response);
        }
예제 #6
0
        public GetTweetResponse GetTweetsSince(GetTweetsRequest request)
        {
            OAuthAccessToken accessToken = request.AccessToken;

            _twitterService.AuthenticateWith(accessToken.Token, accessToken.TokenSecret);

            IEnumerable <TwitterStatus> tweets = _twitterService.ListTweetsOnHomeTimelineSince(request.LastTweetId);

            TweeterStatusAdapter adapter = new TweeterStatusAdapter();

            return(new GetTweetResponse {
                TweeterStatuses = adapter.Convert(tweets)
            });
        }