示例#1
0
        public void TestPersistSqlParameterType()
        {
            TestUsingDatabase.SetupDBOracleConnection();
            IBusinessObject bo            = _itsClassDef.CreateNewBusinessObject();
            StringBuilder   stringBuilder = new StringBuilder();

            stringBuilder.Append('*', 2500);
            string value = stringBuilder.ToString();

            bo.SetPropertyValue("TestProp", value);
            var              sqlCol               = new TransactionalBusinessObjectDB(bo, DatabaseConnection.CurrentConnection).GetPersistSql();
            ISqlStatement    sqlStatement         = sqlCol.First();
            IList            parameters           = sqlStatement.Parameters;
            IDbDataParameter longTextParam        = (IDbDataParameter)parameters[1];
            string           oracleTypeEnumString = ReflectionUtilities.GetEnumPropertyValue(longTextParam, "OracleType");

            Assert.IsTrue(oracleTypeEnumString == "Clob");
        }
示例#2
0
        public void TestPersistSqlParameterValue()
        {
            TestUsingDatabase.SetupDBOracleConnection();
            IBusinessObject bo = _classDef.CreateNewBusinessObject();

            bo.SetPropertyValue("TestProp", "test");
            var              sqlCol          = new TransactionalBusinessObjectDB(bo, DatabaseConnection.CurrentConnection).GetPersistSql();
            ISqlStatement    sqlStatement    = sqlCol.First();
            IList            parameters      = sqlStatement.Parameters;
            IDbDataParameter byteStringParam = (IDbDataParameter)parameters[2];

            Assert.IsTrue(byteStringParam.Value is byte[], "Should be a byte array");
            byte[] paramValue = (byte[])byteStringParam.Value;
            Assert.AreEqual(paramValue.Length, itsByteArrSpelling_test.Length);
            Assert.AreEqual(paramValue[0], itsByteArrSpelling_test[0]);
            Assert.AreEqual(paramValue[1], itsByteArrSpelling_test[1]);
            Assert.AreEqual(paramValue[2], itsByteArrSpelling_test[2]);
            Assert.AreEqual(paramValue[3], itsByteArrSpelling_test[3]);
            Assert.AreEqual(paramValue[4], itsByteArrSpelling_test[4]);
            Assert.AreEqual(paramValue[5], itsByteArrSpelling_test[5]);
            Assert.AreEqual(paramValue[6], itsByteArrSpelling_test[6]);
            Assert.AreEqual(paramValue[7], itsByteArrSpelling_test[7]);
        }