本文整理汇总了C#中ListRequestProcessor.GetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# ListRequestProcessor.GetParameters方法的具体用法?C# ListRequestProcessor.GetParameters怎么用?C# ListRequestProcessor.GetParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListRequestProcessor
的用法示例。
在下文中一共展示了ListRequestProcessor.GetParameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParameters_Parses_All_Available_Parameters
public void GetParameters_Parses_All_Available_Parameters()
{
var listReqProc = new ListRequestProcessor<List>();
Expression<Func<List, bool>> expression =
list =>
list.Type == ListType.Members &&
list.UserID == "456" &&
list.ScreenName == "JoeMayo" &&
list.ListID == "456" &&
list.Slug == "test" &&
list.OwnerID == "789" &&
list.OwnerScreenName == "JoeMayo" &&
list.Cursor == "123" &&
list.MaxID == 789 &&
list.Page == 1 &&
list.Count == 10 &&
list.SinceID == 123 &&
list.FilterToOwnedLists == true &&
list.TrimUser == true &&
list.IncludeEntities == true &&
list.IncludeRetweets == true &&
list.SkipStatus == true &&
list.Reverse == true;
var queryParams = listReqProc.GetParameters(expression);
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("Type", ((int)ListType.Members).ToString())));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("UserID", "456")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("ScreenName", "JoeMayo")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("ListID", "456")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("Slug", "test")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("OwnerID", "789")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("OwnerScreenName", "JoeMayo")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("Cursor", "123")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("MaxID", "789")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("Page", "1")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("Count", "10")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("SinceID", "123")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("FilterToOwnedLists", "True")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("TrimUser", "True")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("IncludeEntities", "True")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("IncludeRetweets", "True")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("SkipStatus", "True")));
Assert.True(
queryParams.Contains(
new KeyValuePair<string, string>("Reverse", "True")));
}
示例2: GetParametersTest
public void GetParametersTest()
{
ListRequestProcessor<List> target = new ListRequestProcessor<List>();
Expression<Func<List, bool>> expression =
list =>
list.Type == ListType.Members &&
list.ScreenName == "JoeMayo" &&
list.Cursor == "123" &&
list.ListID == "456" &&
list.MaxID == 789 &&
list.Page == 1 &&
list.PerPage == 10 &&
list.SinceID == 123 &&
list.ID == "456";
LambdaExpression lambdaExpression = expression as LambdaExpression;
var queryParams = target.GetParameters(lambdaExpression);
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("Type", ((int)ListType.Members).ToString())));
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("ScreenName", "JoeMayo")));
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("Cursor", "123")));
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("ListID", "456")));
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("MaxID", "789")));
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("Page", "1")));
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("PerPage", "10")));
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("SinceID", "123")));
Assert.IsTrue(
queryParams.Contains(
new KeyValuePair<string, string>("ID", "456")));
}