Example #1
0
        void AssertSuccessRestored(object obj)
        {
            var yaml  = serializer.Serialize(obj);
            var nodes = parser.Parse(yaml);

            Assert.AreEqual(1, nodes.Count);
            var restored = constructor.NodeToObject(nodes[0], YamlNode.DefaultConfig);
            var yaml2    = serializer.Serialize(restored);

            Assert.AreEqual(yaml, yaml2);
        }
        void AssertSuccessRestored(object obj)
        {
            var yaml  = serializer.Serialize(obj);
            var nodes = parser.Parse(yaml);

            Assert.AreEqual(1, nodes.Count);
            var yamlConfig = new YamlConfig();

            yamlConfig.LookupAssemblies.Add(typeof(YamlConstructorTest).Assembly);
            var restored = constructor.NodeToObject(nodes[0], new SerializerContext(yamlConfig));
            var yaml2    = serializer.Serialize(restored);

            Assert.AreEqual(yaml, yaml2);
        }