public void TestObject4()
 {
     using (var conn = new DataConnection())
     {
         string param = DB2iSeriesMappingSchema.GetiSeriesType(new LinqToDB.SqlQuery.SqlDataType(DataType.Int64));
         string sql   = string.Format("SELECT cast(@P as {0}){1}", param, TestBase.GetDummyFrom(conn.DataProvider));
         Assert.That(conn.Execute <int>(sql, new { p = 1 }), Is.EqualTo(1));
     }
 }
        public void TestObject3()
        {
            var arr1 = new byte[] { 48, 57 };
            var arr2 = new byte[] { 42 };

            using (var conn = new DataConnection())
            {
                string param = DB2iSeriesMappingSchema.GetiSeriesType(SqlDataType.GetDataType(typeof(byte[])));
                string sql   = string.Format("SELECT cast(@P as {0}){1}", param, TestBase.GetDummyFrom(conn.DataProvider));
                Assert.That(conn.Execute <byte[]>(sql, new { p = arr1 }), Is.EqualTo(arr1));
                Assert.That(conn.Execute <byte[]>(sql, new { p = arr2 }), Is.EqualTo(arr2));
            }
        }
        public void TestObject6()
        {
            using (var conn = new DataConnection())
            {
                string param = DB2iSeriesMappingSchema.GetiSeriesType(new LinqToDB.SqlQuery.SqlDataType(DataType.Int64));
                string sql   = string.Format("SELECT cast(@P as {0}){1}", param, TestBase.GetDummyFrom(conn.DataProvider));

                Assert.That(conn.Execute <string>(
                                sql,
                                new
                {
                    p1 = new DataParameter {
                        Name = "p", DataType = DataType.Char, Value = "123"
                    },
                    p2 = 1
                }), Is.EqualTo("123"));
            }
        }
        //[Test, Ignore("Needs the appropriate mapping schema and value converter instantiating.")]
        public void TestDataParameterMapping2()
        {
            var ms = new MappingSchema();

            ms.SetConvertExpression <TwoValues, DataParameter>(tv => new DataParameter {
                Value = (long)tv.Value1 << 32 | tv.Value2
            });

            using (var conn = new DataConnection().AddMappingSchema(ms))
            {
                string param = DB2iSeriesMappingSchema.GetiSeriesType(new LinqToDB.SqlQuery.SqlDataType(DataType.Int64));
                string sql   = string.Format("SELECT cast(@P as {0}){1}", param, TestBase.GetDummyFrom(conn.DataProvider));

                var n = conn.Execute <long?>(sql, new { p = (TwoValues)null });

                Assert.AreEqual(null, n);
            }
        }