Beispiel #1
0
        public void Map_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();

            DateTime            tm = DateTime.Parse("1998-01-01");
            MapTestObject1_Copy dt = new MapTestObject1_Copy();

            dt.int16Var    = 1;
            dt.int32Var    = 2;
            dt.int64Var    = 3;
            dt.datetimeVar = tm;
            dt.decimalVar  = 1M;
            dt.floatVar    = 2f;
            dt.doubleVar   = 3;

            dt.stringVar = "hello";

            MapTestObject1 obj = new MapTestObject1();

            objectConverter.MapObject(dt, obj);
            Assert.AreEqual(1, obj.int16Var);
            Assert.AreEqual(2, obj.int32Var);
            Assert.AreEqual(3, obj.int64Var);
            Assert.AreEqual(tm, obj.datetimeVar);
            Assert.AreEqual(1M, obj.decimalVar);
            Assert.AreEqual(2f, obj.floatVar);
            Assert.AreEqual(3d, obj.doubleVar);

            MapTestObject2 obj2 = new MapTestObject2();

            objectConverter.MapObject(dt, obj2);
            Assert.AreEqual((short)1, obj2.int16Var);
            Assert.AreEqual(2, obj2.int32Var);
            Assert.AreEqual((long)3, obj2.int64Var);
            Assert.AreEqual(tm, obj2.datetimeVar);
            Assert.AreEqual(1M, obj2.decimalVar);
            Assert.AreEqual(2f, obj2.floatVar);
            Assert.AreEqual(3d, obj2.doubleVar);
        }
        public void Map_Test()
        {
            ObjectConverter objectConverter = new ObjectConverter();

            DateTime tm = DateTime.Parse("1998-01-01");
            MapTestObject1_Copy dt = new MapTestObject1_Copy();
            dt.int16Var = 1;
            dt.int32Var = 2;
            dt.int64Var = 3;
            dt.datetimeVar = tm;
            dt.decimalVar = 1M;
            dt.floatVar = 2f;
            dt.doubleVar = 3;

            dt.stringVar = "hello";

            MapTestObject1 obj = new MapTestObject1();
            objectConverter.MapObject(dt, obj);
            Assert.AreEqual(1, obj.int16Var);
            Assert.AreEqual(2, obj.int32Var);
            Assert.AreEqual(3, obj.int64Var);
            Assert.AreEqual(tm, obj.datetimeVar);
            Assert.AreEqual(1M, obj.decimalVar);
            Assert.AreEqual(2f, obj.floatVar);
            Assert.AreEqual(3d, obj.doubleVar);

            MapTestObject2 obj2 = new MapTestObject2();
            objectConverter.MapObject(dt, obj2);
            Assert.AreEqual((short)1, obj2.int16Var);
            Assert.AreEqual(2, obj2.int32Var);
            Assert.AreEqual((long)3, obj2.int64Var);
            Assert.AreEqual(tm, obj2.datetimeVar);
            Assert.AreEqual(1M, obj2.decimalVar);
            Assert.AreEqual(2f, obj2.floatVar);
            Assert.AreEqual(3d, obj2.doubleVar);
        }