public void ComplexObject_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();
            objectConverter.RegisterConverter(1, new CreationDictionaryObjectConverter("xtype", new DomainTypeResolver(true)));

            Dictionary<string, object> Peter = new Dictionary<string, object>();
            Peter["Name"] = "Peter";

            List<object> pets = new List<object>();
            Dictionary<string, object> xcat = new Dictionary<string, object>();
            xcat["xtype"] = typeof(Cat).FullName;
            xcat["Name"] = "cat1";
            xcat["Age"] = 3;
            pets.Add(xcat);

            Dictionary<string, object> xdog = new Dictionary<string, object>();
            xdog["xtype"] = typeof(Dog).FullName;
            xdog["Name"] = "dog1";
            xdog["Age"] = 5;
            pets.Add(xdog);

            Peter["Pets"] = pets.ToArray();
            Peter["PetList"] = pets.ToArray();

            Person obj = new Person();
            objectConverter.MapObject(Peter, obj);

            Assert.IsNotNull(obj.Pets);
            Assert.AreEqual(2, obj.Pets.Length);

            var cat = obj.Pets[0] as Cat;
            Assert.IsNotNull(cat);
            Assert.AreEqual("cat1", cat.Name);
            Assert.AreEqual(3, cat.Age);

            var dot = obj.Pets[1] as Dog;
            Assert.IsNotNull(dot);
            Assert.AreEqual("dog1", dot.Name);
            Assert.AreEqual(5, dot.Age);

            // check list
            Assert.IsNotNull(obj.PetList);
            Assert.AreEqual(2, obj.PetList.Count);

            cat = obj.PetList[0] as Cat;
            Assert.IsNotNull(cat);
            Assert.AreEqual("cat1", cat.Name);
            Assert.AreEqual(3, cat.Age);

            dot = obj.PetList[1] as Dog;
            Assert.IsNotNull(dot);
            Assert.AreEqual("dog1", dot.Name);
            Assert.AreEqual(5, dot.Age);
        }
        public void MapUnexistPropertyException_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();
            objectConverter.RegisterConverter(1, new CreationDictionaryObjectConverter("xtype", new DomainTypeResolver(true)));

            Dictionary<string, object> dt = new Dictionary<string, object>();
            dt.Add("Name", "QQ");

            MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1();
            objectConverter.MapObject(dt, obj);
            Assert.AreEqual("QQ", obj.Name);
            Assert.AreEqual(100, obj.Age);
        }
        public void DictionObject_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();
            objectConverter.RegisterConverter(1, new CreationDictionaryObjectConverter("xtype", new DomainTypeResolver(true)));

            Dictionary<string, object> routeValue = new Dictionary<string, object>();
            routeValue["Name"] = "A";

            Dictionary<string, object> xcat = new Dictionary<string, object>();
            xcat["Name"] = "Q";
            routeValue["RouteObjects"] = xcat;

            RouteValue obj = new RouteValue();
            objectConverter.MapObject(routeValue, obj);

            Assert.IsNotNull(obj.RouteObjects);
            Assert.AreEqual("Q", obj.RouteObjects["Name"]);
        }