本文整理汇总了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();
}
示例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();
}