本文整理汇总了C#中Users.BeginSearch方法的典型用法代码示例。如果您正苦于以下问题:C# Users.BeginSearch方法的具体用法?C# Users.BeginSearch怎么用?C# Users.BeginSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users.BeginSearch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginSearch_WithValidUser_SetsParameter
public void BeginSearch_WithValidUser_SetsParameter()
{
const 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("q", username));
var users = new Users(twitterClient);
GenericResponseDelegate endSearch = (a, b, c) => { };
// act
users.BeginSearch(username, endSearch);
}
示例2: BeginSearch_WithValidUser_ReturnsUsers
public void BeginSearch_WithValidUser_ReturnsUsers()
{
var wasCalled = false;
var twitterClient = Substitute.For<IBaseTwitterClient>();
twitterClient.SetReponseBasedOnRequestPath();
var users = new Users(twitterClient);
// assert
GenericResponseDelegate endSearch = (a, b, c) =>
{
wasCalled = true;
var results = c as IEnumerable<User>;
Assert.That(results, Is.Not.Empty);
};
// act
users.BeginSearch("abcde", endSearch);
Assert.That(wasCalled, Errors.CallbackDidNotFire);
}