Exemplo n.º 1
0
        public void NotSpecifyingObjectFactoryUsesDefault()
        {
            var deserializer = new Deserializer();
            deserializer.RegisterTagMapping("!foo", typeof(FooBase));
            var result = deserializer.Deserialize(new StringReader("!foo {}"));

            Assert.IsType<FooBase>(result);
        }
Exemplo n.º 2
0
        public void ObjectFactoryIsInvoked()
        {
            var deserializer = new Deserializer(new LambdaObjectFactory(t => new FooDerived()));
            deserializer.RegisterTagMapping("!foo", typeof(FooBase));

            var result = deserializer.Deserialize(new StringReader("!foo {}"));

            Assert.IsType<FooDerived>(result);
        }