示例#1
0
 public void SearchByMaxIdTest1() {
     var target = new SearchService();
     var actual = target.SearchByMaxId();
     Assert.IsNotNull(actual);
     foreach (var item in actual) {
         Debug.WriteLine(item);
     }
 }
示例#2
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));
         }
     }
 }