public void GetODataDeserializer_ReturnsSameDeserializer_ForSameType()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();

            ODataDeserializer firstCallDeserializer = deserializerProvider.GetODataDeserializer(_edmModel, typeof(ODataEntityDeserializerTests.Supplier));
            ODataDeserializer secondCallDeserializer = deserializerProvider.GetODataDeserializer(_edmModel, typeof(ODataEntityDeserializerTests.Supplier));

            Assert.Same(firstCallDeserializer, secondCallDeserializer);
        }
Ejemplo n.º 2
0
        public void GetODataSerializer_ReturnsSameSerializer_ForSameType()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider(_edmModel);

            ODataDeserializer firstCallDeserializer  = deserializerProvider.GetODataDeserializer(typeof(ODataEntityDeserializerTests.Supplier));
            ODataDeserializer secondCallDeserializer = deserializerProvider.GetODataDeserializer(typeof(ODataEntityDeserializerTests.Supplier));

            Assert.Same(firstCallDeserializer, secondCallDeserializer);
        }
Ejemplo n.º 3
0
        public void GetODataDeserializer_ReturnsSameDeserializer_ForSameType()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage        request = new HttpRequestMessage();

            ODataDeserializer firstCallDeserializer = deserializerProvider.GetODataDeserializer(_edmModel,
                                                                                                typeof(ODataEntityDeserializerTests.Supplier), request);
            ODataDeserializer secondCallDeserializer = deserializerProvider.GetODataDeserializer(_edmModel,
                                                                                                 typeof(ODataEntityDeserializerTests.Supplier), request);

            Assert.Same(firstCallDeserializer, secondCallDeserializer);
        }
Ejemplo n.º 4
0
        public void GetODataSerializer_Derived_ActionPayload()
        {
            ODataDeserializerProvider      deserializerProvider = new DefaultODataDeserializerProvider(_edmModel);
            ODataActionPayloadDeserializer derivedActionPayload = deserializerProvider.GetODataDeserializer(typeof(MyActionPayload)) as ODataActionPayloadDeserializer;

            Assert.NotNull(derivedActionPayload);
        }
Ejemplo n.º 5
0
        public void GetODataSerializer_ActionPayload()
        {
            ODataDeserializerProvider      deserializerProvider = new DefaultODataDeserializerProvider(_edmModel);
            ODataActionPayloadDeserializer basicActionPayload   = deserializerProvider.GetODataDeserializer(typeof(ODataActionParameters)) as ODataActionPayloadDeserializer;

            Assert.NotNull(basicActionPayload);
        }
        public void GetODataDeserializer_Throws_ArgumentNullForType()
        {
            DefaultODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();

            Assert.ThrowsArgumentNull(
                () => deserializerProvider.GetODataDeserializer(model: EdmCoreModel.Instance, type: null),
                "type");
        }
        public void GetODataDeserializer_Throws_ArgumentNullForModel()
        {
            DefaultODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();

            Assert.ThrowsArgumentNull(
                () => deserializerProvider.GetODataDeserializer(model: null, type: typeof(int)),
                "model");
        }
Ejemplo n.º 8
0
        public void GetODataDeserializer_Throws_ArgumentNullForModel()
        {
            DefaultODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            Assert.ThrowsArgumentNull(
                () => deserializerProvider.GetODataDeserializer(model: null, type: typeof(int), request: request),
                "model");
        }
        public void GetODataDeserializer_Uri()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, typeof(Uri));

            Assert.NotNull(deserializer);
            var referenceLinkDeserializer = Assert.IsType<ODataEntityReferenceLinkDeserializer>(deserializer);
            Assert.Equal(ODataPayloadKind.EntityReferenceLink, referenceLinkDeserializer.ODataPayloadKind);
        }
Ejemplo n.º 10
0
        public void GetODataDeserializer_ActionPayload()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage        request = new HttpRequestMessage();

            ODataActionPayloadDeserializer basicActionPayload = deserializerProvider.GetODataDeserializer(_edmModel,
                                                                                                          typeof(ODataActionParameters), request) as ODataActionPayloadDeserializer;

            Assert.NotNull(basicActionPayload);
        }
        public void GetODataSerializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider(_edmModel);
            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(type);

            Assert.NotNull(deserializer);
            ODataRawValueDeserializer rawValueDeserializer = Assert.IsType<ODataRawValueDeserializer>(deserializer);
            Assert.Equal(ODataPayloadKind.Value, rawValueDeserializer.ODataPayloadKind);
            Assert.Equal(primitiveKind, rawValueDeserializer.PrimitiveTypeReference.PrimitiveDefinition().PrimitiveKind);
        }
Ejemplo n.º 12
0
        public void GetODataSerializer_Uri()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider(_edmModel);
            ODataDeserializer         deserializer         = deserializerProvider.GetODataDeserializer(typeof(Uri));

            Assert.NotNull(deserializer);
            var referenceLinkDeserializer = Assert.IsType <ODataEntityReferenceLinkDeserializer>(deserializer);

            Assert.Equal(ODataPayloadKind.EntityReferenceLink, referenceLinkDeserializer.ODataPayloadKind);
        }
        public void GetODataDeserializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, type);

            Assert.NotNull(deserializer);
            ODataPrimitiveDeserializer rawValueDeserializer = Assert.IsType<ODataPrimitiveDeserializer>(deserializer);
            Assert.Equal(ODataPayloadKind.Property, rawValueDeserializer.ODataPayloadKind);
            Assert.Equal(primitiveKind, rawValueDeserializer.EdmType.AsPrimitive().PrimitiveDefinition().PrimitiveKind);
        }
        public void GetODataDeserializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, type, request);

            Assert.NotNull(deserializer);
            ODataPrimitiveDeserializer rawValueDeserializer = Assert.IsType<ODataPrimitiveDeserializer>(deserializer);
            Assert.Equal(ODataPayloadKind.Property, rawValueDeserializer.ODataPayloadKind);
        }
Ejemplo n.º 15
0
        public void GetODataSerializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider(_edmModel);
            ODataDeserializer         deserializer         = deserializerProvider.GetODataDeserializer(type);

            Assert.NotNull(deserializer);
            ODataRawValueDeserializer rawValueDeserializer = Assert.IsType <ODataRawValueDeserializer>(deserializer);

            Assert.Equal(ODataPayloadKind.Value, rawValueDeserializer.ODataPayloadKind);
            Assert.Equal(primitiveKind, rawValueDeserializer.PrimitiveTypeReference.PrimitiveDefinition().PrimitiveKind);
        }
        public void GetODataDeserializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataDeserializer         deserializer         = deserializerProvider.GetODataDeserializer(_edmModel, type);

            Assert.NotNull(deserializer);
            ODataPrimitiveDeserializer rawValueDeserializer = Assert.IsType <ODataPrimitiveDeserializer>(deserializer);

            Assert.Equal(ODataPayloadKind.Property, rawValueDeserializer.ODataPayloadKind);
            Assert.Equal(primitiveKind, rawValueDeserializer.EdmType.AsPrimitive().PrimitiveDefinition().PrimitiveKind);
        }
        public void GetODataDeserializer_Entity()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, typeof(ODataEntityDeserializerTests.Product));

            Assert.NotNull(deserializer);
            ODataEntityDeserializer entityDeserializer = Assert.IsType<ODataEntityDeserializer>(deserializer);
            Assert.Equal(deserializer.ODataPayloadKind, ODataPayloadKind.Entry);
            Assert.Equal(entityDeserializer.DeserializerProvider, deserializerProvider);
            Assert.True(entityDeserializer.EntityType.IsEquivalentTo(_edmModel.GetEdmTypeReference(typeof(ODataEntityDeserializerTests.Product))));
            Assert.Equal(entityDeserializer.EdmType, entityDeserializer.EntityType);
        }
Ejemplo n.º 18
0
        public void GetODataDeserializer_Primitive(Type type, EdmPrimitiveTypeKind primitiveKind)
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage        request = new HttpRequestMessage();

            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, type, request);

            Assert.NotNull(deserializer);
            ODataPrimitiveDeserializer rawValueDeserializer = Assert.IsType <ODataPrimitiveDeserializer>(deserializer);

            Assert.Equal(ODataPayloadKind.Property, rawValueDeserializer.ODataPayloadKind);
        }
Ejemplo n.º 19
0
        public void GetODataDeserializer_Uri()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage        request = new HttpRequestMessage();

            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, typeof(Uri), request);

            Assert.NotNull(deserializer);
            var referenceLinkDeserializer = Assert.IsType <ODataEntityReferenceLinkDeserializer>(deserializer);

            Assert.Equal(ODataPayloadKind.EntityReferenceLink, referenceLinkDeserializer.ODataPayloadKind);
        }
        public void GetODataDeserializer_Complex()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel, typeof(ODataEntityDeserializerTests.Address));

            Assert.NotNull(deserializer);
            ODataComplexTypeDeserializer complexDeserializer = Assert.IsType<ODataComplexTypeDeserializer>(deserializer);
            Assert.Equal(deserializer.ODataPayloadKind, ODataPayloadKind.Property);
            Assert.Equal(complexDeserializer.DeserializerProvider, deserializerProvider);
            Assert.True(complexDeserializer.ComplexType.IsEquivalentTo(_edmModel.GetEdmTypeReference(typeof(ODataEntityDeserializerTests.Address))));
            Assert.Equal(complexDeserializer.EdmType, complexDeserializer.ComplexType);
        }
        public void GetODataDeserializer_Complex()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataDeserializer         deserializer         = deserializerProvider.GetODataDeserializer(_edmModel, typeof(ODataEntityDeserializerTests.Address));

            Assert.NotNull(deserializer);
            ODataComplexTypeDeserializer complexDeserializer = Assert.IsType <ODataComplexTypeDeserializer>(deserializer);

            Assert.Equal(deserializer.ODataPayloadKind, ODataPayloadKind.Property);
            Assert.Equal(complexDeserializer.DeserializerProvider, deserializerProvider);
            Assert.True(complexDeserializer.ComplexType.IsEquivalentTo(_edmModel.GetEdmTypeReference(typeof(ODataEntityDeserializerTests.Address))));
            Assert.Equal(complexDeserializer.EdmType, complexDeserializer.ComplexType);
        }
        public void GetODataDeserializer_Entity()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataDeserializer         deserializer         = deserializerProvider.GetODataDeserializer(_edmModel, typeof(ODataEntityDeserializerTests.Product));

            Assert.NotNull(deserializer);
            ODataEntityDeserializer entityDeserializer = Assert.IsType <ODataEntityDeserializer>(deserializer);

            Assert.Equal(deserializer.ODataPayloadKind, ODataPayloadKind.Entry);
            Assert.Equal(entityDeserializer.DeserializerProvider, deserializerProvider);
            Assert.True(entityDeserializer.EntityType.IsEquivalentTo(_edmModel.GetEdmTypeReference(typeof(ODataEntityDeserializerTests.Product))));
            Assert.Equal(entityDeserializer.EdmType, entityDeserializer.EntityType);
        }
        public void GetODataDeserializer_Complex()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel,
                typeof(ODataEntityDeserializerTests.Address), request);

            Assert.NotNull(deserializer);
            ODataComplexTypeDeserializer complexDeserializer = Assert.IsType<ODataComplexTypeDeserializer>(deserializer);
            Assert.Equal(deserializer.ODataPayloadKind, ODataPayloadKind.Property);
            Assert.Equal(complexDeserializer.DeserializerProvider, deserializerProvider);
        }
        public void GetODataDeserializer_Entity()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel,
                typeof(ODataEntityDeserializerTests.Product), request);

            Assert.NotNull(deserializer);
            ODataEntityDeserializer entityDeserializer = Assert.IsType<ODataEntityDeserializer>(deserializer);
            Assert.Equal(deserializer.ODataPayloadKind, ODataPayloadKind.Entry);
            Assert.Equal(entityDeserializer.DeserializerProvider, deserializerProvider);
        }
Ejemplo n.º 25
0
        public void GetODataDeserializer_Complex()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage        request = new HttpRequestMessage();

            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel,
                                                                                       typeof(ODataEntityDeserializerTests.Address), request);

            Assert.NotNull(deserializer);
            ODataComplexTypeDeserializer complexDeserializer = Assert.IsType <ODataComplexTypeDeserializer>(deserializer);

            Assert.Equal(deserializer.ODataPayloadKind, ODataPayloadKind.Property);
            Assert.Equal(complexDeserializer.DeserializerProvider, deserializerProvider);
        }
Ejemplo n.º 26
0
        public void GetODataDeserializer_Entity()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage        request = new HttpRequestMessage();

            ODataDeserializer deserializer = deserializerProvider.GetODataDeserializer(_edmModel,
                                                                                       typeof(ODataEntityDeserializerTests.Product), request);

            Assert.NotNull(deserializer);
            ODataEntityDeserializer entityDeserializer = Assert.IsType <ODataEntityDeserializer>(deserializer);

            Assert.Equal(deserializer.ODataPayloadKind, ODataPayloadKind.Entry);
            Assert.Equal(entityDeserializer.DeserializerProvider, deserializerProvider);
        }
        public void GetODataSerializer_Derived_ActionPayload()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataActionPayloadDeserializer derivedActionPayload = deserializerProvider.GetODataDeserializer(_edmModel, typeof(MyActionPayload)) as ODataActionPayloadDeserializer;

            Assert.NotNull(derivedActionPayload);
        }
        public void GetODataSerializer_ActionPayload()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            ODataActionPayloadDeserializer basicActionPayload = deserializerProvider.GetODataDeserializer(_edmModel, typeof(ODataActionParameters)) as ODataActionPayloadDeserializer;

            Assert.NotNull(basicActionPayload);
        }
        public void GetODataDeserializer_ActionPayload()
        {
            ODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            ODataActionPayloadDeserializer basicActionPayload = deserializerProvider.GetODataDeserializer(_edmModel,
                typeof(ODataActionParameters), request) as ODataActionPayloadDeserializer;

            Assert.NotNull(basicActionPayload);
        }
        public void GetODataDeserializer_Throws_ArgumentNullForType()
        {
            DefaultODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            Assert.ThrowsArgumentNull(
                () => deserializerProvider.GetODataDeserializer(model: EdmCoreModel.Instance, type: null, request: request),
                "type");
        }
        public void GetODataDeserializer_Throws_ArgumentNullForModel()
        {
            DefaultODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();
            HttpRequestMessage request = new HttpRequestMessage();

            Assert.ThrowsArgumentNull(
                () => deserializerProvider.GetODataDeserializer(model: null, type: typeof(int), request: request),
                "model");
        }
        public void GetODataDeserializer_Throws_ArgumentNullForModel()
        {
            DefaultODataDeserializerProvider deserializerProvider = new DefaultODataDeserializerProvider();

            Assert.ThrowsArgumentNull(
                () => deserializerProvider.GetODataDeserializer(model: null, type: typeof(int)),
                "model");
        }