Esempio n. 1
0
 /// <summary>
 /// 新しいツイートのログを取得してデータベースに保存します。
 /// </summary>
 public void InsertTweetLog() {
     using (var searchService = new SearchService())
     using (var tweetLogService = new TweetLogService()) {
         var maxId = default(ulong);
         var sinceId = tweetLogService.GetMaxId().GetValueOrDefault();
         while (sinceId == 0 || maxId == 0 || maxId >= sinceId) {
             var tweetLogs = searchService.SearchByMaxId(maxId);
             if (tweetLogs.Length <= 1) {
                 break;
             }
             foreach (var tweetLog in tweetLogs) {
                 tweetLogService.AddOrUpdate(tweetLog);
             }
             maxId = ulong.Parse(tweetLogs.Min(x => x.StatusId));
         }
     }
 }
Esempio n. 2
0
 public void GetMaxIdTest1() {
     var target = new TweetLogService();
     var actual = target.GetMaxId();
     Debug.WriteLine(actual);
     Assert.AreEqual(actual, (ulong)3);
 }