public void MapUnexistPropertyException_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();

            var target = new MapWithoutPropertyTestObject1_Copy();
            target.Name = "QQ";

            MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1();

            objectConverter.MapObject(target, obj);
            Assert.AreEqual("QQ", obj.Name);
            Assert.AreEqual(100, obj.Age);
        }
Beispiel #2
0
        public void MapUnexistPropertyException_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();

            var target = new MapWithoutPropertyTestObject1_Copy();

            target.Name = "QQ";

            MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1();

            objectConverter.MapObject(target, obj);
            Assert.AreEqual("QQ", obj.Name);
            Assert.AreEqual(100, obj.Age);
        }
        public void MapUnexistProperty_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter()
            {
                IsIgnoreNotExistingProperty = true,
            };

            var target = new MapWithoutPropertyTestObject1_Copy();
            target.Name = "QQ";

            MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1();

            objectConverter.MapObject(target, obj);
            Assert.AreEqual("QQ", obj.Name);
            Assert.AreEqual(100, obj.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 MapUnexistPropertyException_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();

            DataTable dt = new DataTable();
            dt.Columns.Add("Name", typeof(string));

            dt.Rows.Add("QQ");
            var reader = new DataTableReader(dt);
            reader.Read();
            MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1();
            objectConverter.MapObject(reader, obj);

            Assert.AreEqual("QQ", obj.Name);
            Assert.AreEqual(100, obj.Age);
        }
Beispiel #6
0
        public void MapUnexistProperty_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter()
            {
                IsIgnoreNotExistingProperty = true,
            };

            var target = new MapWithoutPropertyTestObject1_Copy();

            target.Name = "QQ";

            MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1();

            objectConverter.MapObject(target, obj);
            Assert.AreEqual("QQ", obj.Name);
            Assert.AreEqual(100, obj.Age);
        }
        public void MapUnexistProperty_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter()
            {
                IsIgnoreNotExistingProperty = 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 MapUnexistPropertyException_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();


            DataTable dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));

            dt.Rows.Add("QQ");
            var reader = new DataTableReader(dt);

            reader.Read();
            MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1();

            objectConverter.MapObject(reader, obj);

            Assert.AreEqual("QQ", obj.Name);
            Assert.AreEqual(100, obj.Age);
        }
        public void MapUnexistProperty_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter()
                {
                    IsIgnoreNotExistingProperty = 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 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);
        }