public void SendTweet_ShouldUpdateTheUserStatus_AndReturnNewTweeterStatusTest()
        {
            OAuthAccessToken accessToken = new OAuthAccessToken {
                Token = "abcd", TokenSecret = "A@c#"
            };

            Mock.Get(_mockTwitterService).Setup(mockService => mockService.AuthenticateWith(accessToken.Token, accessToken.TokenSecret));

            SendTweetRequest request = new SendTweetRequest {
                AccessToken = accessToken, Status = "Hello World"
            };

            TwitterStatus twitterStatusStatus =
                Builder <TwitterStatus>
                .CreateNew()
                .With(x => x.Text = request.Status)
                .With(x => x.User = Builder <TwitterUser> .CreateNew().Build())
                .Build();

            Mock.Get(_mockTwitterService).Setup(mockService => mockService.SendTweet(request.Status)).Returns(twitterStatusStatus);

            SendTweetResponse sendTweetResponse = _authenticationService.SendTweet(request);

            Assert.IsNotNull(sendTweetResponse);
            Assert.AreSame(request.Status, sendTweetResponse.TweeterStatus.Tweet);
        }
예제 #2
0
 public TweetResponse SendTweet(SendTweetRequest tweet)
 {
     Console.WriteLine("In TweetService.SendTweet");
     return(new TweetResponse {
         Message = "SendTweet"
     });
 }
예제 #3
0
        internal void OnTweetActionCommand()
        {
            IsBusy = true;

            SendTweetRequest sendTweetRequest = new SendTweetRequest
            {
                AccessToken = (OAuthAccessToken)_applicationSettingsProvider["accessToken"],
                Status      = TweetText
            };

            _authenticationService.BeginSendTweet(sendTweetRequest, SendTweetCallback, null);
        }
예제 #4
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);
        }
예제 #5
0
        internal void OnTweetActionCommand()
        {
            IsBusy = true;

            SendTweetRequest sendTweetRequest = new SendTweetRequest
                {
                    AccessToken = (OAuthAccessToken)_applicationSettingsProvider["accessToken"],
                    Status = TweetText
                };

            _authenticationService.BeginSendTweet(sendTweetRequest, SendTweetCallback, null);
        }