コード例 #1
0
        public void IsRetweet_ShoulBeTrue_WhenRetweetStatusIsNotNullTest()
        {
            NGTweeterStatus tweeterStatus = new NGTweeterStatus
                {
                    CreatedDate = DateTime.Today,
                    Id = 101,
                    RetweetedStatus =
                        new NGTweeterStatus
                            {
                                CreatedDate = DateTime.Today,
                                Id = 102,
                                Tweet = "Original Tweet",
                                User =
                                    new NGTweeterUser
                                        {
                                            Id = 5,
                                            Name = "Nilesh",
                                            ProfileImageUrl = "Nilesh.jpg",
                                            ScreenName = "NileshGule"
                                        }
                            },
                    User = new NGTweeterUser
                        {
                            Id = 6,
                            Name = "TestName",
                            ProfileImageUrl = "Test.jpg",
                            ScreenName = "TestScreenName"
                        }
                };

            _viewModel = new TweetViewModel(tweeterStatus);
            Assert.IsTrue(_viewModel.IsRetweet);
        }
コード例 #2
0
        public void IsRetweet_ShoulBeTrue_WhenRetweetStatusIsNotNullTest()
        {
            NGTweeterStatus tweeterStatus = new NGTweeterStatus
            {
                CreatedDate     = DateTime.Today,
                Id              = 101,
                RetweetedStatus =
                    new NGTweeterStatus
                {
                    CreatedDate = DateTime.Today,
                    Id          = 102,
                    Tweet       = "Original Tweet",
                    User        =
                        new NGTweeterUser
                    {
                        Id              = 5,
                        Name            = "Nilesh",
                        ProfileImageUrl = "Nilesh.jpg",
                        ScreenName      = "NileshGule"
                    }
                },
                User = new NGTweeterUser
                {
                    Id              = 6,
                    Name            = "TestName",
                    ProfileImageUrl = "Test.jpg",
                    ScreenName      = "TestScreenName"
                }
            };

            _viewModel = new TweetViewModel(tweeterStatus);
            Assert.IsTrue(_viewModel.IsRetweet);
        }
コード例 #3
0
        public void ScreenName_ShoulBeFormattedWithOriginalUserScreenName_WhenRetweetStatusIsNotNullTest()
        {
            NGTweeterStatus tweeterStatus = new NGTweeterStatus
            {
                CreatedDate     = DateTime.Today,
                Id              = 101,
                RetweetedStatus =
                    new NGTweeterStatus
                {
                    CreatedDate = DateTime.Today,
                    Id          = 102,
                    Tweet       = "Original Tweet",
                    User        =
                        new NGTweeterUser
                    {
                        Id              = 5,
                        Name            = "Nilesh",
                        ProfileImageUrl = "Nilesh.jpg",
                        ScreenName      = "NileshGule"
                    }
                },
                User = new NGTweeterUser
                {
                    Id              = 6,
                    Name            = "TestName",
                    ProfileImageUrl = "Test.jpg",
                    ScreenName      = "TestScreenName"
                }
            };

            _viewModel = new TweetViewModel(tweeterStatus);
            Assert.AreEqual("NileshGule, (RT by TestScreenName)", _viewModel.ScreenName);
        }
コード例 #4
0
        public void Convert_WithSingleTwitterStatuses_ShouldReturnSingleResults()
        {
            TwitterStatus twitterStatus =
                Builder <TwitterStatus>
                .CreateNew().With(ts => ts.User = Builder <TwitterUser> .CreateNew().Build())
                .Build();

            NGTweeterStatus result = _tweeterStatusAdapter.Convert(twitterStatus);

            VerifyResults(result, twitterStatus);
        }
コード例 #5
0
 private void AddNewTweet(NGTweeterStatus newTweet)
 {
     if (newTweet.RetweetedStatus == null)
     {
         _tweeterStatusViewModels.Insert(0, new TweetViewModel(newTweet));
     }
     else
     {
         _tweeterStatusViewModels.Insert(0, new RetweetViewModel(newTweet));
     }
 }
コード例 #6
0
        internal void ReTweetExistingTweet(NGTweeterStatus tweet)
        {
            IsBusy = true;

            RetweetRequest retweetRequest = new RetweetRequest
            {
                AccessToken = (OAuthAccessToken)_applicationSettingsProvider["accessToken"],
                TweetId     = tweet.Id
            };

            _authenticationService.BeginRetweet(retweetRequest, RetweetCallback, null);
        }
コード例 #7
0
ファイル: TweetViewModel.cs プロジェクト: NileshGule/NGTweet
        public TweetViewModel(NGTweeterStatus tweeterStatus)
        {
            TweeterStatus = tweeterStatus;

            RetweetCommand = new RelayCommand(OnRetweet);

            _refreshTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(1) };

            _refreshTimer.Tick += (o, args) => RaisePropertyChanged("CreatedDate");

            _refreshTimer.Start();
        }
コード例 #8
0
ファイル: TweetViewModel.cs プロジェクト: NileshGule/NGTweet
        public TweetViewModel(NGTweeterStatus tweeterStatus)
        {
            TweeterStatus = tweeterStatus;

            RetweetCommand = new RelayCommand(OnRetweet);

            _refreshTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMinutes(1)
            };

            _refreshTimer.Tick += (o, args) => RaisePropertyChanged("CreatedDate");

            _refreshTimer.Start();
        }
コード例 #9
0
        public void ScreenName_ShouldReturnOnlyUsersScreenName_WhenRetweetStatusIsNullTest()
        {
            NGTweeterStatus tweeterStatus = new NGTweeterStatus
            {
                CreatedDate = DateTime.Today,
                Id          = 102,
                Tweet       = "Original Tweet",
                User        =
                    new NGTweeterUser
                {
                    Id              = 5,
                    Name            = "Nilesh",
                    ProfileImageUrl = "Nilesh.jpg",
                    ScreenName      = "NileshGule"
                }
            };

            _viewModel = new TweetViewModel(tweeterStatus);
            Assert.AreEqual("NileshGule", _viewModel.ScreenName);
        }
コード例 #10
0
        public void ScreenName_ShoulBeFormattedWithOriginalUserScreenName_WhenRetweetStatusIsNotNullTest()
        {
            NGTweeterStatus tweeterStatus = new NGTweeterStatus
            {
                CreatedDate = DateTime.Today,
                Id = 101,
                RetweetedStatus =
                    new NGTweeterStatus
                    {
                        CreatedDate = DateTime.Today,
                        Id = 102,
                        Tweet = "Original Tweet",
                        User =
                            new NGTweeterUser
                            {
                                Id = 5,
                                Name = "Nilesh",
                                ProfileImageUrl = "Nilesh.jpg",
                                ScreenName = "NileshGule"
                            }
                    },
                User = new NGTweeterUser
                {
                    Id = 6,
                    Name = "TestName",
                    ProfileImageUrl = "Test.jpg",
                    ScreenName = "TestScreenName"
                }
            };

            _viewModel = new TweetViewModel(tweeterStatus);
            Assert.AreEqual("NileshGule, (RT by TestScreenName)", _viewModel.ScreenName);
        }
コード例 #11
0
        public void ScreenName_ShouldReturnOnlyUsersScreenName_WhenRetweetStatusIsNullTest()
        {
            NGTweeterStatus tweeterStatus = new NGTweeterStatus
            {
                CreatedDate = DateTime.Today,
                Id = 102,
                Tweet = "Original Tweet",
                User =
                    new NGTweeterUser
                    {
                        Id = 5,
                        Name = "Nilesh",
                        ProfileImageUrl = "Nilesh.jpg",
                        ScreenName = "NileshGule"
                    }
            };

            _viewModel = new TweetViewModel(tweeterStatus);
            Assert.AreEqual("NileshGule", _viewModel.ScreenName);
        }
コード例 #12
0
 public RetweetViewModel(NGTweeterStatus tweeterStatus)
     : base(tweeterStatus)
 {
 }
コード例 #13
0
        internal void ReTweetExistingTweet(NGTweeterStatus tweet)
        {
            IsBusy = true;

            RetweetRequest retweetRequest = new RetweetRequest
                {
                    AccessToken = (OAuthAccessToken)_applicationSettingsProvider["accessToken"],
                    TweetId = tweet.Id
                };

            _authenticationService.BeginRetweet(retweetRequest, RetweetCallback, null);
        }
コード例 #14
0
 public RetweetViewModel(NGTweeterStatus tweeterStatus)
     : base(tweeterStatus)
 {
 }
コード例 #15
0
 private static void VerifyResults(NGTweeterStatus adaptedStatus, TwitterStatus twitterStatus)
 {
     Assert.AreEqual(twitterStatus.Text, adaptedStatus.Tweet);
     Assert.AreEqual(twitterStatus.CreatedDate.AddHours(8), adaptedStatus.CreatedDate);
 }