本文整理汇总了C#中Statuses.BeginGetTweet方法的典型用法代码示例。如果您正苦于以下问题:C# Statuses.BeginGetTweet方法的具体用法?C# Statuses.BeginGetTweet怎么用?C# Statuses.BeginGetTweet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statuses
的用法示例。
在下文中一共展示了Statuses.BeginGetTweet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginGetTweet_WhichFindsATweet_ReturnsSuccessfulTweet
public void BeginGetTweet_WhichFindsATweet_ReturnsSuccessfulTweet()
{
var wasCalled = false;
var twitterClient = Substitute.For<IBaseTwitterClient>();
twitterClient.SetResponse(File.ReadAllText(@".\Data\statuses\show-existing.txt"));
var statuses = new Statuses(twitterClient);
// assert
GenericResponseDelegate endGetTweet = (a, b, c) =>
{
wasCalled = true;
var tweet = c as Tweet;
Assert.That(tweet, Is.Not.Null);
Assert.That(tweet.Id, Is.EqualTo(16381619317248000));
};
// act
statuses.BeginGetTweet("16381619317248000", endGetTweet);
Assert.That(wasCalled, Errors.CallbackDidNotFire);
}
示例2: BeginGetTweet_WhichDoesNotFindATweet_ReturnsExceptionResponse
public void BeginGetTweet_WhichDoesNotFindATweet_ReturnsExceptionResponse()
{
// arrange
var wasCalled = false;
var twitterClient = Substitute.For<IBaseTwitterClient>();
twitterClient.SetResponse(File.ReadAllText(@".\Data\statuses\show-missing.txt"));
var statuses = new Statuses(twitterClient);
// assert
GenericResponseDelegate endGetTweet = (a, b, c) =>
{
wasCalled = true;
var exception = c as ExceptionResponse;
Assert.That(exception, Is.Not.Null);
};
// act
statuses.BeginGetTweet("12345", endGetTweet);
Assert.That(wasCalled, Errors.CallbackDidNotFire);
}