• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Tweet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Tweet的典型用法代码示例。如果您正苦于以下问题:C# Tweet类的具体用法?C# Tweet怎么用?C# Tweet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tweet类属于命名空间,在下文中一共展示了Tweet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetUpSteps

        protected override void SetUpSteps()
        {
            Given("the Refresh Cycle is {0} seconds", RefreshCycle =>
                App.Settings.DefaultRefreshCycle =
                    Int32.Parse(RefreshCycle) * 1000
            );

            And("Home is shown", () => {
                HomePresenter.Load();
                OriginalFirstTweet = TweetsShown[0];
            });

            When("Status is updated", () =>
                HomePresenter.TweetService.UpdateStatus(Tweet)
            );

            And("{0} seconds have passed", WaitTime =>
                Thread.Sleep(Convert.ToInt32(WaitTime)*1000)
            );

            Then("Home should contain the Tweet", () =>
                TweetsShown.ToList().ShouldContain(Tweet)
            );

            And("the Tweet should be shown above the older ones", () => {
                TweetsShown.ToList().ShouldContain(Tweet);
                TweetsShown.IndexOf(Tweet).ShouldBeLessThan(
                    TweetsShown.IndexOf(OriginalFirstTweet));}
            );
        }
开发者ID:msuarz,项目名称:zunzun,代码行数:30,代码来源:RefreshingTweets.cs


示例2: Create

        public ActionResult Create(TweetViewModel tweet)
        {
            if (this.ModelState.IsValid)
            {
                tweet.AuthorId = this.User.Identity.GetUserId();

                var newTweet = new Tweet {AuthorId = tweet.AuthorId, Text = tweet.Text};
                this.db.Tweets.Add(newTweet);
                this.db.SaveChanges();

                // Show Tweet to all followers
                var context = GlobalHost.ConnectionManager.GetHubContext<TweeterHub>();
                var usernames = this.UserProfile.Followers.Select(f => f.UserName).ToList();
                context.Clients.Users(usernames).showTweet(newTweet.Id);

                this.TempData["message"] = "Tweet added successfully.";
                this.TempData["isMessageSuccess"] = true;

                return this.RedirectToAction("Index", "Home");
            }

            this.TempData["message"] = "There are problem with tweet adding.";
            this.TempData["isMessageSuccess"] = false;

            this.ViewBag.AuthorId = new SelectList(this.db.Users, "Id", "FullName", tweet.AuthorId);
            return this.View("Tweet/_CreateTweetPartial", tweet);
        }
开发者ID:DesislavaPetkova,项目名称:Tweeter-App,代码行数:27,代码来源:TweetsController.cs


示例3: Deserialize

        public object Deserialize(JsonValue value, JsonMapper mapper)
        {
            Tweet tweet = new Tweet();

            tweet.ID = value.GetValue<long>("id");
            tweet.Text = value.GetValue<string>("text");
            JsonValue fromUserValue = value.GetValue("user");
            string dateFormat;
            if (fromUserValue != null)
            {
                tweet.FromUser = fromUserValue.GetValue<string>("screen_name");
                tweet.FromUserId = fromUserValue.GetValue<long>("id");
                tweet.ProfileImageUrl = fromUserValue.GetValue<string>("profile_image_url");
                dateFormat = TIMELINE_DATE_FORMAT;
            }
            else
            {
                tweet.FromUser = value.GetValue<string>("from_user");
                tweet.FromUserId = value.GetValue<long>("from_user_id");
                tweet.ProfileImageUrl = value.GetValue<string>("profile_image_url");
                dateFormat = SEARCH_DATE_FORMAT;
            }
            tweet.CreatedAt = JsonUtils.ToDateTime(value.GetValue<string>("created_at"), dateFormat);
            tweet.Source = value.GetValue<string>("source");
            JsonValue toUserIdValue = value.GetValue("in_reply_to_user_id");
            tweet.ToUserId = (toUserIdValue != null) ? toUserIdValue.GetValue<long?>() : null;
            JsonValue languageCodeValue = value.GetValue("iso_language_code");
            tweet.LanguageCode = (languageCodeValue != null) ? languageCodeValue.GetValue<string>() : null;
            JsonValue inReplyToStatusIdValue = value.GetValue("in_reply_to_status_id");
            tweet.InReplyToStatusId = ((inReplyToStatusIdValue != null) && !inReplyToStatusIdValue.IsNull) ? inReplyToStatusIdValue.GetValue<long?>() : null;

            return tweet;
        }
开发者ID:erijss,项目名称:spring-net-social-twitter,代码行数:33,代码来源:TweetDeserializer.cs


示例4: TweetToHtmlFormatUsernames

        public void TweetToHtmlFormatUsernames()
        {
            var text = "RT @topascz: Test tweet";
            var tweet = new Tweet(new TwitterUser(null, null, null, null, null, 0, 0, 0), text, DateTime.MinValue, String.Empty);

            Assert.Equal("RT <a href=\"https://www.twitter.com/topascz\">@topascz</a>: Test tweet", tweet.TextToHtmlString().ToString());
        }
开发者ID:topas,项目名称:TweetsDotNet,代码行数:7,代码来源:TweetExtensionsTest.cs


示例5: Add

 // Imitates a queue appending a status at the end of the list
 public void Add(Tweet status)
 {
     if (_tweets.Find(t => status.Id == t.Id) == null)
     {
         _tweets.Insert(_tweets.Count, status);
     }
 }
开发者ID:vgheri,项目名称:TwitterSearch,代码行数:8,代码来源:QueueRepository.cs


示例6: TweetToHtmlFormatNotLink

        public void TweetToHtmlFormatNotLink()
        {
            var text = "Testing link www.twitter.com";
            var tweet = new Tweet(new TwitterUser(null, null, null, null, null, 0, 0, 0), text, DateTime.MinValue, String.Empty);

            Assert.Equal("Testing link www.twitter.com", tweet.TextToHtmlString().ToString());
        }
开发者ID:topas,项目名称:TweetsDotNet,代码行数:7,代码来源:TweetExtensionsTest.cs


示例7: TweetToHtmlFormatNotUsernames

        public void TweetToHtmlFormatNotUsernames()
        {
            var text = "Some email [email protected] @123";
            var tweet = new Tweet(new TwitterUser(null, null, null, null, null, 0, 0, 0), text, DateTime.MinValue, String.Empty);

            Assert.Equal("Some email [email protected] @123", tweet.TextToHtmlString().ToString());
        }
开发者ID:topas,项目名称:TweetsDotNet,代码行数:7,代码来源:TweetExtensionsTest.cs


示例8: TweetToHtmlFormatNotHashtags

        public void TweetToHtmlFormatNotHashtags()
        {
            var text = "Next test#test";
            var tweet = new Tweet(new TwitterUser(null, null, null, null, null, 0, 0, 0), text, DateTime.MinValue, String.Empty);

            Assert.Equal("Next test#test", tweet.TextToHtmlString().ToString());
        }
开发者ID:topas,项目名称:TweetsDotNet,代码行数:7,代码来源:TweetExtensionsTest.cs


示例9: TweetToHtmlFormatHttpsLink

        public void TweetToHtmlFormatHttpsLink()
        {
            var text = "Testing link https://www.twitter.com";
            var tweet = new Tweet(new TwitterUser(null, null, null, null, null, 0, 0, 0), text, DateTime.MinValue, String.Empty);

            Assert.Equal("Testing link <a href=\"https://www.twitter.com\">https://www.twitter.com</a>", tweet.TextToHtmlString().ToString());
        }
开发者ID:topas,项目名称:TweetsDotNet,代码行数:7,代码来源:TweetExtensionsTest.cs


示例10: TweetToHtmlFormatHashtags

        public void TweetToHtmlFormatHashtags()
        {
            var text = "Next #test #like";
            var tweet = new Tweet(new TwitterUser(null, null, null, null, null, 0, 0, 0), text, DateTime.MinValue, String.Empty);

            Assert.Equal("Next <a href=\"https://www.twitter.com/search/#test\">#test</a> <a href=\"https://www.twitter.com/search/#like\">#like</a>", tweet.TextToHtmlString().ToString());
        }
开发者ID:topas,项目名称:TweetsDotNet,代码行数:7,代码来源:TweetExtensionsTest.cs


示例11: processTweet

 private void processTweet(Tweet tweet, bool force)
 {
     if (tweet != null)
     {
         Trace.WriteLine(tweet.text, "Information");
     }
 }
开发者ID:tomasmcguinness,项目名称:shadow.io,代码行数:7,代码来源:WorkerRole.cs


示例12: AssertSingleTweet

	    protected void AssertSingleTweet(Tweet tweet) 
        {
		    Assert.AreEqual(12345, tweet.ID);
		    Assert.AreEqual("Tweet 1", tweet.Text);
            Assert.IsNotNull(tweet.CreatedAt);
            Assert.AreEqual("13/07/2010 17:38:21", tweet.CreatedAt.Value.ToUniversalTime().ToString("dd/MM/yyyy HH:mm:ss"));
            Assert.AreEqual("habuma", tweet.User.ScreenName);
            Assert.AreEqual(112233, tweet.User.ID);
            Assert.AreEqual("http://a3.twimg.com/profile_images/1205746571/me2_300.jpg", tweet.User.ProfileImageUrl);
		    Assert.AreEqual("habuma", tweet.FromUser); // Deprecated
            Assert.AreEqual(112233, tweet.FromUserId); // Deprecated
            Assert.AreEqual("http://a3.twimg.com/profile_images/1205746571/me2_300.jpg", tweet.ProfileImageUrl); // Deprecated
            Assert.IsNotNull(tweet.InReplyToStatusId);
		    Assert.AreEqual(123123123123, tweet.InReplyToStatusId.Value);
            Assert.IsNotNull(tweet.InReplyToUserId);
            Assert.AreEqual(332211, tweet.InReplyToUserId.Value);
            Assert.IsNotNull(tweet.ToUserId); // Deprecated
            Assert.AreEqual(332211, tweet.ToUserId.Value); // Deprecated
            Assert.AreEqual("brbaia", tweet.InReplyToUserScreenName);
            Assert.AreEqual("Spring Social Showcase", tweet.Source);
            Assert.AreEqual(9, tweet.FavoriteCount);
            Assert.AreEqual(12, tweet.RetweetCount);
            Assert.IsTrue(tweet.IsRetweetedByUser);
            Assert.IsTrue(tweet.IsFavoritedByUser);
	    }
开发者ID:kisspa,项目名称:spring-net-social-twitter,代码行数:25,代码来源:AbstractTwitterOperationsTests.cs


示例13: GetSearchResults

        public TweetCollection GetSearchResults(string searchText, IWebProxy webProxy)
        {
            TweetCollection tweets = new TweetCollection();

            string tweetscanUrl = "http://tweetscan.com/trss.php?s=" + searchText;

            HttpWebRequest request = WebRequest.Create(tweetscanUrl) as HttpWebRequest;

            // Add configured web proxy
            request.Proxy = webProxy;

            //try
            //{
                // Get the Web Response
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    // Get the response stream
                    StreamReader reader = new StreamReader(response.GetResponseStream());

                    // Load the response data into a XmlDocument
                    XmlDocument doc = new XmlDocument();
                    doc.Load(reader);

                    // Get statuses with XPath
                    XmlNodeList nodes = doc.SelectNodes("/rss/channel/item");

                    foreach (XmlNode node in nodes)
                    {
                        Tweet tweet = new Tweet();
                        tweet.Id = double.Parse(node.SelectSingleNode("tweetid").InnerText);
                        tweet.Text = HttpUtility.HtmlDecode(node.SelectSingleNode("text").InnerText);

                        string dateString = node.SelectSingleNode("pubdate").InnerText;
                        if (!string.IsNullOrEmpty(dateString))
                        {
                            tweet.DateCreated = DateTime.Parse(dateString);
                        }

                        User user = new User();

                        user.Name = node.SelectSingleNode("username").InnerText;
                        user.ScreenName = node.SelectSingleNode("screenname").InnerText;
                        user.ImageUrl = node.SelectSingleNode("image").InnerText;

                        tweet.User = user;

                        tweets.Add(tweet);
                    }

                    tweets.SaveToDisk();
                }
            //}
            //catch {
            ////TODO: not sure what kind of errors are thrown by tweetcan
            //    // eat it.
            //}

            return tweets;
        }
开发者ID:jredville,项目名称:irwitty,代码行数:59,代码来源:TweetScanHelper.cs


示例14: Create

 public void Create(Tweet tweet)
 {
     using (var context = new TwitterEntities())
     {
         context.Tweets.Add(tweet);
         context.SaveChanges();
     }
 }
开发者ID:ZrinkaFiamengo,项目名称:NWT_Twitter,代码行数:8,代码来源:TweetRepository.cs


示例15: TweetThis

 private static void TweetThis(TwitterClient twitterClient, Tweet tweet, Sender<TweetStatus> sender) {
     var response = twitterClient.Tweet(tweet.Message, tweet.Token);
     var tweetStatus = new TweetStatus {
         CorrelationId = tweet.CorrelationId,
         Status = response
     };
     sender.Send(tweetStatus);
 }
开发者ID:slieser,项目名称:sandbox2,代码行数:8,代码来源:Program.cs


示例16: Tweet_added_to_empty_collection_succeeds

 public void Tweet_added_to_empty_collection_succeeds()
 {
     TweetCollection tweets = new TweetCollection();
     Tweet tweet = new Tweet() { DateCreated = DateTime.Now, Id = 1 };
     tweets.Add(tweet);
     Assert.That(tweets.Contains(tweet));
     Assert.That(tweets.Count == 1);
 }
开发者ID:emuikernel,项目名称:wittytwitter,代码行数:8,代码来源:TweetTest.cs


示例17: MapToCredentials

 private static InMemoryCredentials MapToCredentials(Token consumerToken, Tweet tweet) {
     return new InMemoryCredentials {
         ConsumerKey = consumerToken.Key,
         ConsumerSecret = consumerToken.Secret,
         AccessToken = tweet.AccessToken,
         OAuthToken = tweet.OAuthToken
     };
 }
开发者ID:slieser,项目名称:sandbox2,代码行数:8,代码来源:Program.cs


示例18: TweetLexer

        public TweetLexer(Tweet tweet)
        {
            _Tweet = tweet;
            if(_Tweet.text == null)
                throw new NullReferenceException("The message text should NEVER be null. This is really BAD!");

            _CurrentIndex = 0;
            _EndIndex = tweet.text.Length - 1;
        }
开发者ID:jcbozonier,项目名称:twitduel,代码行数:9,代码来源:TweetLexer.cs


示例19: Update

 public void Update(Tweet Tweet)
 {
     if (HasAssociatedTweet)
     {
         Tweet.ReplyTo = AssociatedTweetId;
         TweetService.SendReply(Tweet);
     }
     else
         TweetService.UpdateStatus(Tweet);
 }
开发者ID:msuarz,项目名称:zunzun,代码行数:10,代码来源:UpdateStatusPresenter.cs


示例20: Work

 public override void Work()
 {
     HttpWebRequest req = HTTPXML.StartRequest("http://search.twitter.com/search.atom?" +
         "q=" + Uri.EscapeDataString(this.Query) +
         "&since_id=" + this.LastID.ToString()
         );
     WebResponse res = req.GetResponse();
     XmlDocument doc = new XmlDocument();
     Stream s = res.GetResponseStream();
     doc.Load(s);
     s.Close();
     int maxid = 0;
     foreach (XmlNode node in doc.GetElementsByTagName("entry", ATOMURI))
     {
         Tweet t = new Tweet();
         foreach (XmlNode entry in node.ChildNodes)
         {
             if (entry.NamespaceURI != ATOMURI)
                 continue;
             switch (entry.Name)
             {
                 case "id":
                     int id = ParseIDTag(entry.InnerText);
                     t.ID = id;
                     if (id > maxid)
                         maxid = id;
                     break;
                 case "title":
                     t.Text = entry.InnerText;
                     break;
                 case "author":
                     foreach (XmlNode authorentry in entry.ChildNodes)
                     {
                         if (entry.NamespaceURI != ATOMURI)
                             continue;
                         switch (authorentry.Name)
                         {
                             case "name":
                                 t.Nick = authorentry.InnerText.Split(' ')[0];
                                 break;
                         }
                     }
                     break;
             }
         }
         Tweets.Add(t);
     }
     lock (lastids)
     {
         if (maxid > lastids[this.Query])
             lastids[this.Query] = maxid;
     }
     HTTPXML.FinishRequest(req);
 }
开发者ID:scy,项目名称:twarph,代码行数:54,代码来源:Search.cs



注:本文中的Tweet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TwilioResponse类代码示例发布时间:2022-05-24
下一篇:
C# Tweener类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap