public void PersistSQLparamaterValue_WhenByteArrayNull_WhenSQLServer_ShouldNotExist_FIXBUG1741()
        {
            //---------------Set up test pack-------------------
            var loader   = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            var classDef = loader.LoadClass(@"
					<class name=""MyBO"" assembly=""Habanero.Test"">
						<property  name=""MyBoID"" type=""Guid"" />
						<property  name=""ByteArrayProp"" type=""Byte[]"" />
						<primaryKey>
							<prop name=""MyBoID"" />
						</primaryKey>
					</class>
				"                );

            ClassDef.ClassDefs.Clear();
            ClassDef.ClassDefs.Add(classDef);
            var bo = classDef.CreateNewBusinessObject();

            bo.SetPropertyValue("ByteArrayProp", null);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var sqlCol       = new TransactionalBusinessObjectDB(bo, DatabaseConnection.CurrentConnection).GetPersistSql();
            var sqlStatement = sqlCol.First();

            //IList parameters = sqlStatement.Parameters;

            DatabaseConnection.CurrentConnection.ExecuteSql(sqlStatement);
            //---------------Test Result -----------------------
            Assert.Pass("If it got here then it is OK");
        }
예제 #2
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");
        }
예제 #3
0
        public void PersistSQLparamaterValue_WhenByteArrayNull_WhenMySQL_ShouldNotExist_FIXBUG1741()
        {
            //---------------Set up test pack-------------------
            TestUsingDatabase.SetupDBDataAccessor();
            var bo = _classDef.CreateNewBusinessObject();

            bo.SetPropertyValue("ByteArrayProp", null);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var sqlCol       = new TransactionalBusinessObjectDB(bo, DatabaseConnection.CurrentConnection).GetPersistSql();
            var sqlStatement = sqlCol.First();

            //IList parameters = sqlStatement.Parameters;

            DatabaseConnection.CurrentConnection.ExecuteSql(sqlStatement);
            //---------------Test Result -----------------------
            Assert.Pass("If it got here then it is OK");
        }
예제 #4
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]);
        }