Пример #1
0
        public void Test_Reading_A_Valid_Identifier_String()
        {
            string     value      = "TOA1";
            Identifier identifier = Identifier.From(value);
            Scalar     scalar     = new Scalar(value);

            parser.Current.Returns(scalar);

            object result = converter.ReadYaml(parser, IDENTIFIER_TYPE);

            result.Should().Be(identifier);
        }
Пример #2
0
        bool INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func <IParser, Type, object> nestedObjectDeserializer, out object value)
        {
            IYamlTypeConverter yamlTypeConverter = converters.FirstOrDefault((IYamlTypeConverter c) => c.Accepts(expectedType));

            if (yamlTypeConverter == null)
            {
                value = null;
                return(false);
            }
            value = yamlTypeConverter.ReadYaml(parser, expectedType);
            return(true);
        }
Пример #3
0
 private object DeserializeWithYamlTypeConverter(EventReader reader, Type type, IYamlTypeConverter converter)
 {
     return(converter.ReadYaml(reader.Parser, type));
 }