Пример #1
0
 public void TweetTest() {
     var expected = new Entry();
     expected.Title = string.Join("", Enumerable.Repeat("1234567890", 200));
     expected.Url = "http://www.google.co.jp";
     var target = new TweetService();
     target.Tweet(expected);
 }
Пример #2
0
 /// <summary>
 /// 指定したコラムの内容をツイートします。
 /// </summary>
 /// <param name="entry"><see cref="NawakoraBot.Models.Entry"/>。</param>
 public void Tweet(Entry entry) {
     var hashTag = ConfigurationManager.AppSettings["HashTag"];
     var status = new StringBuilder();
     status.Append(" " + entry.Url);
     status.Append(" " + hashTag);
     if (entry.Title.Length + status.Length <= 140) {
         status.Insert(0, entry.Title);
     } else {
         status.Insert(0, entry.Title.Substring(0, 140 - (status.Length + 3)) + "...");
     }
     this.twitterToken.Statuses.Update(status.ToString());
 }