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


C# KeyValuePair.SelectMany方法代码示例

本文整理汇总了C#中KeyValuePair.SelectMany方法的典型用法代码示例。如果您正苦于以下问题:C# KeyValuePair.SelectMany方法的具体用法?C# KeyValuePair.SelectMany怎么用?C# KeyValuePair.SelectMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KeyValuePair的用法示例。


在下文中一共展示了KeyValuePair.SelectMany方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InlineChildrenTest

        public void InlineChildrenTest()
        {
            KeyValuePair<string, ExpectedException>[] paddingToSkip = new KeyValuePair<string, ExpectedException>[]
            {
                new KeyValuePair<string, ExpectedException>(string.Empty, null),
                new KeyValuePair<string, ExpectedException>("  \r\n\t", null),
                new KeyValuePair<string, ExpectedException>("<!-- some -->   <?value?>", null),
                new KeyValuePair<string, ExpectedException>("some text", null),
                new KeyValuePair<string, ExpectedException>("<![CDATA[cdata]]>", null),
                new KeyValuePair<string, ExpectedException>("<c:some xmlns:c='c'/>", null),
                // The default namespace is ATOM, so this element is in ATOM namespace and thus rejected.
                new KeyValuePair<string, ExpectedException>("<unknown/>", ODataExpectedExceptions.ODataException("ODataAtomEntryAndFeedDeserializer_UnknownElementInInline", "unknown")),
                new KeyValuePair<string, ExpectedException>("<m:unknown/>", null),
                new KeyValuePair<string, ExpectedException>("<d:unknown/>", null),
            };

            IEnumerable<PayloadReaderTestDescriptor> testDescriptors = paddingToSkip.SelectMany(padding =>
                new[]
                {
                    // Empty m:inline
                    new PayloadReaderTestDescriptor(this.Settings)
                    {
                        PayloadElement = PayloadBuilder.Entity().Property(
                            PayloadBuilder.ExpandedNavigationProperty("NavProp", PayloadBuilder.NullEntity(), "http://odata.org/link").XmlRepresentation(string.Format(CultureInfo.InvariantCulture,
                                "<link rel='http://docs.oasis-open.org/odata/ns/related/NavProp' href='http://odata.org/link' type='application/atom+xml;type=entry'>" +
                                "<m:inline>{0}</m:inline>" +
                                "</link>",
                                padding.Key))
                            ),
                        ExpectedException = padding.Value
                    },
                    // Expanded entry
                    new PayloadReaderTestDescriptor(this.Settings)
                    {
                        PayloadElement = PayloadBuilder.Entity().Property(
                            PayloadBuilder.ExpandedNavigationProperty("NavProp", PayloadBuilder.Entity(), "http://odata.org/link").XmlRepresentation(string.Format(CultureInfo.InvariantCulture,
                                "<link rel='http://docs.oasis-open.org/odata/ns/related/NavProp' href='http://odata.org/link' type='application/atom+xml;type=entry'>" +
                                "<m:inline>{0}" +
                                "<entry/>{0}" +
                                "</m:inline>" +
                                "</link>",
                                padding.Key))
                            ),
                        ExpectedException = padding.Value
                    },
                    // Expanded feed
                    new PayloadReaderTestDescriptor(this.Settings)
                    {
                        PayloadElement = PayloadBuilder.Entity().Property(
                            PayloadBuilder.ExpandedNavigationProperty("NavProp", PayloadBuilder.EntitySet(), "http://odata.org/link").XmlRepresentation(string.Format(CultureInfo.InvariantCulture,
                                "<link rel='http://docs.oasis-open.org/odata/ns/related/NavProp' href='http://odata.org/link' type='application/atom+xml;type=feed'>" +
                                "<m:inline>{0}" +
                                "<feed/>{0}" +
                                "</m:inline>" +
                                "</link>",
                                padding.Key))
                            ),
                        ExpectedException = padding.Value
                    },
                });

            this.CombinatorialEngineProvider.RunCombinations(
                testDescriptors,
                this.ReaderTestConfigurationProvider.AtomFormatConfigurations,
                (testDescriptor, testConfiguration) =>
                {
                    testDescriptor.RunTest(testConfiguration);
                });
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:69,代码来源:NavigationLinkReaderAtomTests.cs


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