当前位置: 首页>>代码示例>>C#>>正文


C# ListRequestProcessor.GetParameters方法代码示例

本文整理汇总了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")));
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:81,代码来源:ListRequestProcessorTests.cs

示例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")));
        }
开发者ID:giggio,项目名称:tweetercloud,代码行数:46,代码来源:ListRequestProcessorTest.cs


注:本文中的ListRequestProcessor.GetParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。