public void GetDataAsFixedTypeFromDynamic()
        {
              // Note we only support 1-1 mapping for now
            var t = new BaseDb2ObjectTranslator<Sysobjects>(); // <<-- need to have the ability to inject the map. 
            SqlCommand cmd = CreateTextCommand("Select * from sysobjects");
            var result = t.Translate(ExecuteDataTable(cmd)); //<< inject a filter with parameters..

            foreach (var o in result)
            {
                string s = o.name;
                Trace.WriteLine(s);
            }
        }
        public void BaseDb2ObjectTranslatorTestCharMapping()
        {
            var da = new UnitTestDataAccess();
            da.ExecuteNonQuery(DropTestTableSQL());
            da.ExecuteNonQuery(CreateTestTable("char(1)"));
            da.ExecuteNonQuery(InsertTestDataSQL("'T'"));

            var target = new BaseDb2ObjectTranslator<TestClassChar>();
            SqlCommand cmd = CreateTextCommand(SelectTestDataSQL());
            var result = target.Translate(ExecuteDataRow(cmd));
            
            Assert.AreEqual('T', result.Col);

            da.ExecuteNonQuery(DropTestTableSQL());
        }
        public void BaseDb2ObjectTranslatorTestTestSysobjectsMapping()
        {
            var t = new BaseDb2ObjectTranslator<TestSysobjects>();
            SqlCommand cmd = CreateTextCommand("Select * from sysobjects");
            var result = t.Translate(ExecuteDataTable(cmd));

            Assert.IsTrue(result.Count > 0);

            var outputformat = "{0}\t{1}\t{2}\t{3}";
            Trace.WriteLine(string.Format(outputformat, "id", "name", "xtype", "crdate"));
            foreach (var item in result)
            {
                Trace.WriteLine(string.Format(outputformat, item.id, item.name, item.xtype, item.crdate));
            }
        }
        public void BaseDb2ObjectTranslatorTestTimeSpanMapping()
        {
            var da = new UnitTestDataAccess();
            da.ExecuteNonQuery(DropTestTableSQL());
            da.ExecuteNonQuery(CreateTestTable("time(0)"));
            da.ExecuteNonQuery(InsertTestDataSQL("'01:02:03'"));

            var target = new BaseDb2ObjectTranslator<TestClassTimeSpan>();
            var cmd = CreateTextCommand(SelectTestDataSQL());
            var result = target.Translate(ExecuteDataRow(cmd));

            Assert.AreEqual(new TimeSpan(1,2,3), result.Col);

            da.ExecuteNonQuery(DropTestTableSQL());
        }