public void ReadFromStreamAsync_ForUnType()
        {
            // Arrange
            string content = "{\"@odata.type\":\"#NS.Color\",\"value\":\"Blue\"}";

            ODataEnumDeserializer deserializer = new ODataEnumDeserializer();
            ODataDeserializerContext readContext = new ODataDeserializerContext
            {
                Model = _edmModel,
                ResourceType = typeof(IEdmEnumObject)
            };

            // Act
            object value = deserializer.Read(GetODataMessageReader(GetODataMessage(content), _edmModel),
                typeof(Color), readContext);

            // Assert
            EdmEnumObject color = Assert.IsType<EdmEnumObject>(value);
            Assert.NotNull(color);

            Assert.Equal("Blue", color.Value);
        }
Beispiel #2
0
        public void ReadFromStreamAsync_ForUnType()
        {
            // Arrange
            string content = "{\"@odata.type\":\"#NS.Color\",\"value\":\"Blue\"}";

            ODataEnumDeserializer    deserializer = new ODataEnumDeserializer();
            ODataDeserializerContext readContext  = new ODataDeserializerContext
            {
                Model        = _edmModel,
                ResourceType = typeof(IEdmEnumObject)
            };

            // Act
            object value = deserializer.Read(GetODataMessageReader(GetODataMessage(content), _edmModel),
                                             typeof(Color), readContext);

            // Assert
            EdmEnumObject color = Assert.IsType <EdmEnumObject>(value);

            Assert.NotNull(color);

            Assert.Equal("Blue", color.Value);
        }