本文整理汇总了C#中Block.BeginBlock方法的典型用法代码示例。如果您正苦于以下问题:C# Block.BeginBlock方法的具体用法?C# Block.BeginBlock怎么用?C# Block.BeginBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block.BeginBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginBlock_WithSomeName_ProvidesParameter
public void BeginBlock_WithSomeName_ProvidesParameter()
{
// arrange
string username = "abcde";
var twitterClient = Substitute.For<IBaseTwitterClient>();
twitterClient.When(a => a.BeginRequest(Arg.Any<string>(), Arg.Any<IDictionary<string, string>>(), Arg.Any<WebMethod>(), Arg.Any<RestCallback>()))
.Do(c => c.AssertParameter("screen_name", username));
var statuses = new Block(twitterClient);
// act
statuses.BeginBlock(username, (a, b, c) => { });
}
示例2: BeginBlock_WithSomeName_ReturnsUser
public void BeginBlock_WithSomeName_ReturnsUser()
{
var wasCalled = false;
var twitterClient = Substitute.For<IBaseTwitterClient>();
twitterClient.SetReponseBasedOnRequestPath();
var statuses = new Block(twitterClient);
// assert
GenericResponseDelegate endBlock = (a, b, c) =>
{
wasCalled = true;
var user = c as User;
Assert.That(user, Is.Not.Null);
};
// act
statuses.BeginBlock("abcde", endBlock);
Assert.That(wasCalled, Errors.CallbackDidNotFire);
}