Exemple #1
0
 protected override void Context()
 {
     _tweets      = new TweetCollection();
     _totalTweets = 20;
     _keepCount   = 5;
     for (int i = 1; i <= _totalTweets; i++)
     {
         var tweet = new Tweet {
             Id = i
         };
         _tweets.Insert(0, tweet);
         _tweets.Insert(0, tweet);
     }
 }
 private void ProcessNewTweetMessages(object obj, DownloadStringCompletedEventArgs args)
 {
     try
     {
         System.Diagnostics.Debug.WriteLine(args.Result);
         StockTwits_Stream_Symbol s = JsonConvert.DeserializeObject <StockTwits_Stream_Symbol>(args.Result);
         Cursor = s.cursor;
         Array.Reverse(s.messages);
         foreach (StockTwits_Message m in s.messages)
         {
             TweetCollection.Insert(0, new TweetItemViewModel()
             {
                 Author = m.user.name + " (" + m.user.username + ")", Content = m.body, PubDate = m.created_at
             });
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
         System.Diagnostics.Debug.WriteLine(ex.Source);
         System.Diagnostics.Debug.WriteLine(ex.StackTrace);
     }
     if (ProgressBar != null)
     {
         ProgressBar.IsVisible = false;
     }
     this.IsDataLoaded = true;
 }
Exemple #3
0
        public void Truncate()
        {
            int count = 10;

            TweetCollection tweets = new TweetCollection();

            for (int i = 0; i < 20; i++)
            {
                Tweet tweet = new Tweet();
                tweet.Id = i;
                tweets.Insert(0, tweet);
            }

            tweets.TruncateAfter(count);

            Assert.AreEqual(count, tweets.Count);
            Assert.AreEqual(tweets[0].Id, 19);
        }
Exemple #4
0
        public void Truncate()
        {
            int count = 10;

            TweetCollection tweets = new TweetCollection();

            for (int i = 0; i < 20; i++)
            {
                Tweet tweet = new Tweet();
                tweet.Id = i;
                tweets.Insert(0, tweet);
            }

            tweets.TruncateAfter(count);

            Assert.AreEqual(count, tweets.Count);
            Assert.AreEqual(tweets[0].Id, 19);
        }
Exemple #5
0
 protected override void Context()
 {
     _tweets = new TweetCollection();
     _totalTweets = 20;
     _keepCount = 5;
     for (int i = 1; i <= _totalTweets; i++)
     {
         var tweet = new Tweet { Id = i };
         _tweets.Insert(0, tweet);
         _tweets.Insert(0, tweet);
     }
 }