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); }
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 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_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); }
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); }
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_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); }