示例#1
0
        public void TestNullValue()
        {
            RunTest(new CamelObjectSnakeDbBindStrategy(ParameterMarker), (con) =>
            {
                var nullItem = new TestTableSnakeCaseItem();
                if (DbConnectionType == typeof(System.Data.SqlClient.SqlConnection))
                {
                    nullItem.v_date_time = CurrentDateTimeWithoutMilli();
                    nullItem.v_blob      = new byte[0];
                }

                InsertToTestTable(con, nullItem);

                string sql  = ToProperSql(string.Format("SELECT * FROM {0}", TEST_TABLE_NAME));
                var fetched = con.NewDataset(sql)
                              .OpenAndFetch <TestTableCamelCaseItem>();
                Assert.AreEqual(nullItem.v_string, fetched.VString);
                Assert.AreEqual(nullItem.v_short, fetched.VShort);
                Assert.AreEqual(nullItem.v_int, fetched.VInt);
                Assert.AreEqual(nullItem.v_long, fetched.VLong);
                Assert.AreEqual(nullItem.v_double, fetched.VDouble);
                Assert.AreEqual(nullItem.v_decimal, fetched.VDecimal);
                Assert.AreEqual(nullItem.v_date_time, fetched.VDateTime);
                CollectionAssert.AreEqual(nullItem.v_blob, fetched.VBlob);
                Assert.AreEqual(nullItem.v_long_text, fetched.VLongText);
            });
        }
示例#2
0
 private void InsertToTestTable(IConnection con, TestTableSnakeCaseItem testTableItem)
 {
     con.NewCommand(ToProperSql(SqlInsertInto))
     .SetParam("v_string", testTableItem.v_string)
     .SetParam("v_short", testTableItem.v_short)
     .SetParam("v_int", testTableItem.v_int)
     .SetParam("v_long", testTableItem.v_long)
     .SetParam("v_double", testTableItem.v_double)
     .SetParam("v_decimal", testTableItem.v_decimal)
     .SetParam("v_date_time", testTableItem.v_date_time)
     .SetParam("v_blob", testTableItem.v_blob)
     .SetParam("v_long_text", testTableItem.v_long_text)
     .Execute();
 }