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


C# DefaultODataSerializerProvider.GetODataPayloadSerializer方法代码示例

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


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

示例1: GetODataPayloadSerializer_ThrowsArgumentNull_Model

        public void GetODataPayloadSerializer_ThrowsArgumentNull_Model()
        {
            DefaultODataSerializerProvider serializerProvider = new DefaultODataSerializerProvider();

            Assert.ThrowsArgumentNull(
                () => serializerProvider.GetODataPayloadSerializer(model: null, type: null),
               "model");
        }
开发者ID:Rhombulus,项目名称:aspnetwebstack,代码行数:8,代码来源:DefaultODataSerializerProviderTests.cs

示例2: GetODataPayloadSerializer_ThrowsArgumentNull_Type

        public void GetODataPayloadSerializer_ThrowsArgumentNull_Type()
        {
            DefaultODataSerializerProvider serializerProvider = new DefaultODataSerializerProvider();

            Assert.ThrowsArgumentNull(
                () => serializerProvider.GetODataPayloadSerializer(model: EdmCoreModel.Instance, type: null),
               "type");
        }
开发者ID:Rhombulus,项目名称:aspnetwebstack,代码行数:8,代码来源:DefaultODataSerializerProviderTests.cs

示例3: GetODataPayloadSerializer_ThrowsArgumentNull_Model

        public void GetODataPayloadSerializer_ThrowsArgumentNull_Model()
        {
            DefaultODataSerializerProvider serializerProvider = new DefaultODataSerializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            Assert.ThrowsArgumentNull(
                () => serializerProvider.GetODataPayloadSerializer(model: null, type: typeof(int), request: request),
               "model");
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:9,代码来源:DefaultODataSerializerProviderTests.cs

示例4: GetODataPayloadSerializer_ThrowsArgumentNull_Request

        public void GetODataPayloadSerializer_ThrowsArgumentNull_Request()
        {
            DefaultODataSerializerProvider serializerProvider = new DefaultODataSerializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            Assert.ThrowsArgumentNull(
                () => serializerProvider.GetODataPayloadSerializer(EdmCoreModel.Instance, typeof(int), request: null),
               "request");
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:9,代码来源:DefaultODataSerializerProviderTests.cs

示例5: GetODataSerializer_Primitive

        public void GetODataSerializer_Primitive(Type type, EdmPrimitiveTypeKind edmPrimitiveTypeKind)
        {
            var serializerProvider = new DefaultODataSerializerProvider(_edmModel);
            var serializer = serializerProvider.GetODataPayloadSerializer(type);

            Assert.NotNull(serializer);
            var primitiveSerializer = Assert.IsType<ODataPrimitiveSerializer>(serializer);
            Assert.Equal(primitiveSerializer.EdmType.AsPrimitive().PrimitiveKind(), edmPrimitiveTypeKind);
            Assert.Equal(primitiveSerializer.ODataPayloadKind, ODataPayloadKind.Property);
        }
开发者ID:marojeri,项目名称:aspnetwebstack,代码行数:10,代码来源:DefaultODataSerializerProviderTests.cs

示例6: GetODataSerializer_Primitive

        public void GetODataSerializer_Primitive(Type type, EdmPrimitiveTypeKind edmPrimitiveTypeKind)
        {
            var serializerProvider = new DefaultODataSerializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();
            var serializer = serializerProvider.GetODataPayloadSerializer(_edmModel, type, request);

            Assert.NotNull(serializer);
            var primitiveSerializer = Assert.IsType<ODataPrimitiveSerializer>(serializer);
            Assert.Equal(primitiveSerializer.ODataPayloadKind, ODataPayloadKind.Property);
        }
开发者ID:quentez,项目名称:aspnetwebstack,代码行数:10,代码来源:DefaultODataSerializerProviderTests.cs

示例7: GetODataSerializer_Complex

        public void GetODataSerializer_Complex()
        {
            var serializerProvider = new DefaultODataSerializerProvider(_edmModel);
            var serializer = serializerProvider.GetODataPayloadSerializer(typeof(ODataEntityDeserializerTests.Address));

            Assert.NotNull(serializer);
            var complexSerializer = Assert.IsType<ODataComplexTypeSerializer>(serializer);
            Assert.True(complexSerializer.EdmType.IsEquivalentTo(_edmModel.GetEdmTypeReference(typeof(ODataEntityDeserializerTests.Address))));
            Assert.Equal(complexSerializer.SerializerProvider, serializerProvider);
            Assert.Equal(complexSerializer.ODataPayloadKind, ODataPayloadKind.Property);
        }
开发者ID:marojeri,项目名称:aspnetwebstack,代码行数:11,代码来源:DefaultODataSerializerProviderTests.cs

示例8: GetODataSerializer_Entity

        public void GetODataSerializer_Entity()
        {
            var serializerProvider = new DefaultODataSerializerProvider(_edmModel);
            var serializer = serializerProvider.GetODataPayloadSerializer(typeof(ODataEntityDeserializerTests.Product));

            Assert.NotNull(serializer);
            var entitySerializer = Assert.IsType<ODataEntityTypeSerializer>(serializer);
            Assert.True(entitySerializer.EdmType.IsEquivalentTo(_edmModel.GetEdmTypeReference(typeof(ODataEntityDeserializerTests.Product))));
            Assert.Equal(entitySerializer.SerializerProvider, serializerProvider);
            Assert.Equal(entitySerializer.ODataPayloadKind, ODataPayloadKind.Entry);
        }
开发者ID:marojeri,项目名称:aspnetwebstack,代码行数:11,代码来源:DefaultODataSerializerProviderTests.cs

示例9: GetODataSerializer_ReturnsSameSerializer_ForSameType

        public void GetODataSerializer_ReturnsSameSerializer_ForSameType()
        {
            ODataSerializerProvider serializerProvider = new DefaultODataSerializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            ODataSerializer firstCallSerializer = serializerProvider.GetODataPayloadSerializer(_edmModel,
                typeof(ODataEntityDeserializerTests.Supplier), request);
            ODataSerializer secondCallSerializer = serializerProvider.GetODataPayloadSerializer(_edmModel,
                typeof(ODataEntityDeserializerTests.Supplier), request);

            Assert.Same(firstCallSerializer, secondCallSerializer);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:12,代码来源:DefaultODataSerializerProviderTests.cs

示例10: GetODataSerializer_Returns_ExpectedSerializerType

        public void GetODataSerializer_Returns_ExpectedSerializerType(Type payloadType, Type expectedSerializerType)
        {
            ODataSerializerProvider serializerProvider = new DefaultODataSerializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            ODataSerializer serializer = serializerProvider.GetODataPayloadSerializer(_edmModel, payloadType, request);

            Assert.NotNull(serializer);
            Assert.IsType(expectedSerializerType, serializer);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:10,代码来源:DefaultODataSerializerProviderTests.cs

示例11: GetODataSerializer_ComplexCollection

        public void GetODataSerializer_ComplexCollection()
        {
            var serializerProvider = new DefaultODataSerializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            var serializer = serializerProvider.GetODataPayloadSerializer(_edmModel,
                typeof(IEnumerable<ODataEntityDeserializerTests.Address>), request);

            Assert.NotNull(serializer);
            var collectionSerializer = Assert.IsType<ODataCollectionSerializer>(serializer);
            Assert.Equal(collectionSerializer.ODataPayloadKind, ODataPayloadKind.Collection);
            Assert.Equal(collectionSerializer.SerializerProvider, serializerProvider);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:13,代码来源:DefaultODataSerializerProviderTests.cs

示例12: GetODataSerializer_Feed

        public void GetODataSerializer_Feed(Type collectionType)
        {
            var serializerProvider = new DefaultODataSerializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            var serializer = serializerProvider.GetODataPayloadSerializer(_edmModel, collectionType, request);

            Assert.NotNull(serializer);
            var feedSerializer = Assert.IsType<ODataFeedSerializer>(serializer);
            Assert.Equal(feedSerializer.ODataPayloadKind, ODataPayloadKind.Feed);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:11,代码来源:DefaultODataSerializerProviderTests.cs

示例13: GetODataSerializer_Complex

        public void GetODataSerializer_Complex()
        {
            var serializerProvider = new DefaultODataSerializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();
            var serializer = serializerProvider.GetODataPayloadSerializer(_edmModel, typeof(ODataEntityDeserializerTests.Address), request);

            Assert.NotNull(serializer);
            var complexSerializer = Assert.IsType<ODataComplexTypeSerializer>(serializer);
            Assert.Equal(complexSerializer.SerializerProvider, serializerProvider);
            Assert.Equal(complexSerializer.ODataPayloadKind, ODataPayloadKind.Property);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:11,代码来源:DefaultODataSerializerProviderTests.cs

示例14: GetODataSerializer_ODataError

        public void GetODataSerializer_ODataError()
        {
            ODataSerializerProvider serializerProvider = new DefaultODataSerializerProvider();

            ODataSerializer serializer = serializerProvider.GetODataPayloadSerializer(_edmModel, typeof(ODataError));
            Assert.NotNull(serializer);
            Assert.Equal(typeof(ODataErrorSerializer), serializer.GetType());
            Assert.Equal(ODataPayloadKind.Error, serializer.ODataPayloadKind);
        }
开发者ID:Rhombulus,项目名称:aspnetwebstack,代码行数:9,代码来源:DefaultODataSerializerProviderTests.cs

示例15: GetODataSerializer_ComplexCollection

        public void GetODataSerializer_ComplexCollection()
        {
            var serializerProvider = new DefaultODataSerializerProvider();
            var serializer = serializerProvider.GetODataPayloadSerializer(_edmModel, typeof(IEnumerable<ODataEntityDeserializerTests.Address>));

            Assert.NotNull(serializer);
            var collectionSerializer = Assert.IsType<ODataCollectionSerializer>(serializer);
            Assert.True(collectionSerializer.EdmType.IsCollection());
            Assert.True(collectionSerializer
                .EdmType.AsCollection()
                .ElementType()
                .IsEquivalentTo(_edmModel.GetEdmTypeReference(typeof(ODataEntityDeserializerTests.Address))));
            Assert.Equal(collectionSerializer.ODataPayloadKind, ODataPayloadKind.Collection);
            Assert.Equal(collectionSerializer.SerializerProvider, serializerProvider);
        }
开发者ID:Rhombulus,项目名称:aspnetwebstack,代码行数:15,代码来源:DefaultODataSerializerProviderTests.cs


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