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


C# MediaTypeFormatter.SequenceEqual方法代码示例

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


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

示例1: IsODataFormatter_ReturnsTrue_For_Derived_ODataFormatters

        public void IsODataFormatter_ReturnsTrue_For_Derived_ODataFormatters()
        {
            // Arrange
            HttpConfiguration configuration = new HttpConfiguration();
            ODataMediaTypeFormatter formatter1 = CreateODataFormatter();
            DerivedODataMediaTypeFormatter formatter2 = new DerivedODataMediaTypeFormatter(new ODataPayloadKind[0]);
            configuration.Formatters.Add(formatter1);
            configuration.Formatters.Add(formatter2);

            // Act
            IEnumerable<MediaTypeFormatter> result = configuration.Formatters.Where(f => f != null && Decorator.GetInner(f) is ODataMediaTypeFormatter);

            // Assert
            IEnumerable<MediaTypeFormatter> expectedFormatters = new MediaTypeFormatter[]
            {
                formatter1, formatter2
            };

            Assert.True(expectedFormatters.SequenceEqual(result));
        }
开发者ID:quentez,项目名称:aspnetwebstack,代码行数:20,代码来源:ODataHttpConfigurationExtensionTest.cs

示例2: IsODataFormatter_ReturnsTrue_ForODataFormatters

        public void IsODataFormatter_ReturnsTrue_ForODataFormatters()
        {
            // Arrange
            HttpConfiguration configuration = new HttpConfiguration();
            ODataMediaTypeFormatter formatter1 = CreateODataFormatter();
            ODataMediaTypeFormatter formatter2 = CreateODataFormatter();
            configuration.Formatters.Add(formatter1);
            configuration.Formatters.Add(formatter2);

            // Act
            IEnumerable<MediaTypeFormatter> result = configuration.Formatters.Where(f => f != null && f.IsODataFormatter());

            // Assert
            IEnumerable<MediaTypeFormatter> expectedFormatters = new MediaTypeFormatter[]
            {
                formatter1, formatter2
            };

            Assert.True(expectedFormatters.SequenceEqual(result));
        }
开发者ID:naulizzang,项目名称:aspnetwebstack,代码行数:20,代码来源:ODataHttpConfigurationExtensionTest.cs

示例3: Constructor1_AcceptsDuplicateFormatterTypes

        public void Constructor1_AcceptsDuplicateFormatterTypes()
        {
            MediaTypeFormatter[] formatters = new MediaTypeFormatter[]
            {
                new XmlMediaTypeFormatter(),
                new JsonMediaTypeFormatter(),
                new FormUrlEncodedMediaTypeFormatter(),
                new XmlMediaTypeFormatter(),
                new JsonMediaTypeFormatter(),
                new FormUrlEncodedMediaTypeFormatter(),
            };

            MediaTypeFormatterCollection collection = new MediaTypeFormatterCollection(formatters);
            Assert.True(formatters.SequenceEqual(collection));
        }
开发者ID:chrissimon-au,项目名称:aspnetwebstack,代码行数:15,代码来源:MediaTypeFormatterCollectionTests.cs

示例4: Constructor1_AcceptsDuplicateFormatterTypes

        public void Constructor1_AcceptsDuplicateFormatterTypes()
        {
            MediaTypeFormatter[] formatters = new MediaTypeFormatter[]
            {
                new XmlMediaTypeFormatter(),
                new JsonMediaTypeFormatter(),
#if !NETFX_CORE // No FormUrlEncodedMediaTypeFormatter in portable library version
                new FormUrlEncodedMediaTypeFormatter(),
#endif
                new XmlMediaTypeFormatter(),
                new JsonMediaTypeFormatter(),
#if !NETFX_CORE // No FormUrlEncodedMediaTypeFormatter in portable library version
                new FormUrlEncodedMediaTypeFormatter(),
#endif
            };

            MediaTypeFormatterCollection collection = new MediaTypeFormatterCollection(formatters);
            Assert.True(formatters.SequenceEqual(collection));
        }
开发者ID:Rhombulus,项目名称:aspnetwebstack,代码行数:19,代码来源:MediaTypeFormatterCollectionTests.cs

示例5: GetODataFormatters_ReturnsFormatter_IfSet

        public void GetODataFormatters_ReturnsFormatter_IfSet()
        {
            // Arrange
            HttpConfiguration configuration = new HttpConfiguration();
            ODataMediaTypeFormatter formatter1 = CreateODataFormatter();
            ODataMediaTypeFormatter formatter2 = CreateODataFormatter();
            configuration.Formatters.Add(formatter1);
            configuration.Formatters.Add(formatter2);

            // Act
            IEnumerable<MediaTypeFormatter> result = configuration.GetODataFormatters();

            // Assert
            IEnumerable<MediaTypeFormatter> expectedFormatters = new MediaTypeFormatter[]
            {
                formatter1, formatter2
            };

            Assert.True(expectedFormatters.SequenceEqual(result));
        }
开发者ID:Swethach,项目名称:aspnetwebstack,代码行数:20,代码来源:HttpConfigurationExtensionTests.cs


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