当前位置: 首页>>代码示例>>C#>>正文


C# Statuses.Add方法代码示例

本文整理汇总了C#中Statuses.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Statuses.Add方法的具体用法?C# Statuses.Add怎么用?C# Statuses.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Statuses的用法示例。


在下文中一共展示了Statuses.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanRefreshAddToExistingTweetsCollection

        public void CanRefreshAddToExistingTweetsCollection()
        {
            // setup twitter api mock return values
            Statuses statuses = new Statuses();
            statuses.Add(new Status { Id = "000", CreatedAt = DateTime.Today });
            statuses.Add(new Status { Id = "111", CreatedAt = DateTime.Today.AddDays(-2) });
            statuses.Add(new Status { Id = "222", CreatedAt = DateTime.Today.AddDays(-4) });

            // add some tweets to tweet manager
            _tweetsManager.All.Add(new Status { Id = "888", CreatedAt = DateTime.Today.AddDays(-10) });
            _tweetsManager.All.Add(new Status { Id = "999", CreatedAt = DateTime.Today.AddDays(-12) });

            // record
            Expect.Call(_twitterApiClient.FriendsTimelineSince("888")).Return(statuses);

            // playback
            _mocks.ReplayAll();
            _tweetsManager.Refresh();

            // assert
            Assert.AreEqual(5, _tweetsManager.All.Count);
            Assert.AreEqual("000", _tweetsManager.All[0].Id);
            Assert.AreEqual("111", _tweetsManager.All[1].Id);
            Assert.AreEqual("222", _tweetsManager.All[2].Id);
            Assert.AreEqual("888", _tweetsManager.All[3].Id);
            Assert.AreEqual("999", _tweetsManager.All[4].Id);
            _mocks.VerifyAll();
        }
开发者ID:TlhanGhun,项目名称:digiTweetSnarlEdition,代码行数:28,代码来源:TweetsManagerTests.cs

示例2: CanRefreshReplaceAllTweetsWhenTweetsCollectionIsEmpty

        public void CanRefreshReplaceAllTweetsWhenTweetsCollectionIsEmpty()
        {
            // setup twitter api mock return values
            Statuses statuses = new Statuses();
            statuses.Add(new Status { Id = "000", CreatedAt = DateTime.Today });
            statuses.Add(new Status { Id = "111", CreatedAt = DateTime.Today.AddDays(-2) });
            statuses.Add(new Status { Id = "222", CreatedAt = DateTime.Today.AddDays(-4) });

            // record
            Expect.Call(_twitterApiClient.FriendsTimeline()).Return(statuses);

            // playback
            _mocks.ReplayAll();
            _tweetsManager.Refresh();

            // assert
            Assert.AreEqual(3, _tweetsManager.All.Count);
            Assert.AreEqual("000", _tweetsManager.All[0].Id);
            Assert.AreEqual("111", _tweetsManager.All[1].Id);
            Assert.AreEqual("222", _tweetsManager.All[2].Id);
            _mocks.VerifyAll();
        }
开发者ID:TlhanGhun,项目名称:digiTweetSnarlEdition,代码行数:22,代码来源:TweetsManagerTests.cs


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