public void CreateODataValue_ReturnsODataNullValue_ForNullValue() { IEdmPrimitiveTypeReference edmPrimitiveType = EdmLibHelpers.GetEdmPrimitiveTypeReferenceOrNull(typeof(string)); var serializer = new ODataPrimitiveSerializer(); var odataValue = serializer.CreateODataValue(null, edmPrimitiveType, new ODataSerializerContext()); Assert.IsType <ODataNullValue>(odataValue); }
public void CreateODataValue_PrimitiveValue() { IEdmPrimitiveTypeReference edmPrimitiveType = EdmLibHelpers.GetEdmPrimitiveTypeReferenceOrNull(typeof(int)); var serializer = new ODataPrimitiveSerializer(); var odataValue = serializer.CreateODataValue(20, edmPrimitiveType, writeContext: null); Assert.NotNull(odataValue); ODataPrimitiveValue primitiveValue = Assert.IsType <ODataPrimitiveValue>(odataValue); Assert.Equal(primitiveValue.Value, 20); }
public void CreateODataValue_ReturnsODataNullValue_ForNullValue() { IEdmPrimitiveTypeReference edmPrimitiveType = EdmLibHelpers.GetEdmPrimitiveTypeReferenceOrNull(typeof(string)); var serializer = new ODataPrimitiveSerializer(); var odataValue = serializer.CreateODataValue(null, edmPrimitiveType, new ODataSerializerContext()); Assert.IsType<ODataNullValue>(odataValue); }
public void CreateODataValue_PrimitiveValue() { IEdmPrimitiveTypeReference edmPrimitiveType = EdmLibHelpers.GetEdmPrimitiveTypeReferenceOrNull(typeof(int)); var serializer = new ODataPrimitiveSerializer(); var odataValue = serializer.CreateODataValue(20, edmPrimitiveType, writeContext: null); Assert.NotNull(odataValue); ODataPrimitiveValue primitiveValue = Assert.IsType<ODataPrimitiveValue>(odataValue); Assert.Equal(primitiveValue.Value, 20); }