Example #1
0
        public void TestMethod_Row2Object2()
        {
            BizBO   bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;
            DataRow dr    = bizBo.add2();
            MyCity2 city  = DBUtil.Row2Object <MyCity2>(dr);

            Assert.AreEqual(0, city.city_id1, "id ");
            Assert.AreEqual("A Corua (La Corua)", city.city, "cityname");
            Assert.AreEqual(87, city.country_id, "countryid");
        }
Example #2
0
        public void TestMethod_Row2Object()
        {
            BizBO   bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;
            DataRow dr    = bizBo.add2();
            MyCity  city  = DBUtil.Row2Object <MyCity>(dr);

            Assert.AreEqual(1, city.city_id, "id is 1");
            //BizBO bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;
            //DataRow dr = bizBo.add2();
            //TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); //获取当前时间的刻度数
            //for (int i = 0; i < 3000; i++)
            //{
            //    MyCity city = DBUtil.Row2Object<MyCity>(dr);
            //}
            //TimeSpan ts2 = new TimeSpan(DateTime.Now.Ticks);
            //TimeSpan ts = ts2.Subtract(ts1).Duration(); //时间差的绝对值
            //string spanTotalSeconds = ts.TotalSeconds.ToString(); //执行时间的总秒数
            //Console.WriteLine("执行时间总秒数:" + spanTotalSeconds);
        }