public void TestLoadAllLikeTop()
        {
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                List <Kinetix.Data.SqlClient.Test.Bean> list = new List <Kinetix.Data.SqlClient.Test.Bean>();
                for (byte i = 0; i < 10; i++)
                {
                    Kinetix.Data.SqlClient.Test.Bean b = new Kinetix.Data.SqlClient.Test.Bean();
                    b.Pk           = i;
                    b.DataBool     = true;
                    b.DataByte     = i;
                    b.DataBytes    = new byte[i];
                    b.DataChar     = (char)(i + 64);
                    b.DataChars    = new char[i];
                    b.DataDateTime = DateTime.Now;
                    b.DataDecimal  = i;
                    b.DataDouble   = i;
                    b.DataFloat    = i;
                    b.DataGuid     = Guid.NewGuid();
                    b.DataInt      = i;
                    b.DataLong     = i;
                    b.DataShort    = i;
                    b.DataString   = i.ToString();
                    list.Add(b);
                }
                TestDbProviderFactory.DefinedNextResult(list);

                OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean> store = new OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean>("test");
                FilterCriteria criteria = new FilterCriteria().Equals(Kinetix.Data.SqlClient.Test.Bean.Cols.BEA_FLOAT, 3);
                QueryParameter sort     = new QueryParameter(Kinetix.Data.SqlClient.Test.Bean.Cols.BEA_FLOAT, SortOrder.Asc, 10);
                Kinetix.Data.SqlClient.Test.TestDbCommand command = Kinetix.Data.SqlClient.Test.TestDbCommand.LastCommand;
                Assert.AreEqual("select * from (select BEA_PK, BEA_LONG, BEA_SHORT, BEA_GUID, BEA_FLOAT, BEA_DOUBLE, BEA_DECIMAL, BEA_DATETIME, BEA_CHARS, BEA_CHAR, BEA_BYTE, BEA_BOOL, BEA_INT, BEA_STRING from BEAN where BEA_FLOAT = :BEA_FLOAT order by BEA_FLOAT asc) where rownum <= 10", command.CommandText);
                //Assert.AreEqual(10 + 1, command.Parameters["top"].Value);
                Assert.AreEqual(3, command.Parameters["BEA_FLOAT"].Value);
            }
        }
 public void TestRemoveAllLikeWithoutCriteria()
 {
     using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
         OracleSqlStore <Bean> store = new OracleSqlStore <Bean>("test");
         store.RemoveAllByCriteria(new FilterCriteria());
         Kinetix.Data.SqlClient.Test.TestDbCommand command = Kinetix.Data.SqlClient.Test.TestDbCommand.LastCommand;
         Assert.AreEqual("delete from BEAN where BEA_PK = :BEA_PK", command.CommandText);
     }
 }
 public void TestDelete()
 {
     using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
         OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean> store = new OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean>("test");
         store.Remove(1);
         Kinetix.Data.SqlClient.Test.TestDbCommand command = Kinetix.Data.SqlClient.Test.TestDbCommand.LastCommand;
         Assert.IsTrue(command.CommandText.Contains("delete from BEAN where BEA_PK = :BEA_PK"));
     }
 }
        public void TestInsert()
        {
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                List <PkBean> list = new List <PkBean>();
                PkBean        b    = new PkBean();
                b.Pk = 1;
                list.Add(b);
                TestDbProviderFactory.DefinedNextResult(list);

                OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean> store = new OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean>("test");
                Assert.AreEqual(1, store.Put(new Kinetix.Data.SqlClient.Test.Bean()));
                Kinetix.Data.SqlClient.Test.TestDbCommand command = Kinetix.Data.SqlClient.Test.TestDbCommand.LastCommand;
                Assert.IsTrue(command.CommandText.Contains("insert into BEAN(BEA_PK, BEA_LONG, BEA_SHORT, BEA_GUID, BEA_FLOAT, BEA_DOUBLE, BEA_DECIMAL, BEA_DATETIME, BEA_CHARS, BEA_CHAR, BEA_BYTES, BEA_BYTE, BEA_BOOL, BEA_INT, BEA_STRING) values (BEAN_SEQ.nextval, :BEA_LONG, :BEA_SHORT, :BEA_GUID, :BEA_FLOAT, :BEA_DOUBLE, :BEA_DECIMAL, :BEA_DATETIME, :BEA_CHARS, :BEA_CHAR, :BEA_BYTES, :BEA_BYTE, :BEA_BOOL, :BEA_INT, :BEA_STRING) returning BEA_PK into :inserted_key"));
            }
        }
        public void TestUpdate()
        {
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                List <PkBean> list = new List <PkBean>();
                PkBean        b    = new PkBean();
                b.Pk = 1;
                list.Add(b);
                TestDbProviderFactory.DefinedNextResult(list);

                OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean> store = new OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean>("test");
                Kinetix.Data.SqlClient.Test.Bean bean = new Kinetix.Data.SqlClient.Test.Bean();
                bean.Pk = 1;
                Assert.AreEqual(1, store.Put(bean));
                Kinetix.Data.SqlClient.Test.TestDbCommand command = Kinetix.Data.SqlClient.Test.TestDbCommand.LastCommand;
                Assert.IsTrue(command.CommandText.Contains("update BEAN set BEA_LONG = :BEA_LONG, BEA_SHORT = :BEA_SHORT, BEA_GUID = :BEA_GUID, BEA_FLOAT = :BEA_FLOAT, BEA_DOUBLE = :BEA_DOUBLE, BEA_DECIMAL = :BEA_DECIMAL, BEA_DATETIME = :BEA_DATETIME, BEA_CHARS = :BEA_CHARS, BEA_CHAR = :BEA_CHAR, BEA_BYTES = :BEA_BYTES, BEA_BYTE = :BEA_BYTE, BEA_BOOL = :BEA_BOOL, BEA_INT = :BEA_INT, BEA_STRING = :BEA_STRING where BEA_PK = :BEA_PK"));
            }
        }
        public void TestInsertWithIncrementalUpdate()
        {
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                List <Kinetix.Data.SqlClient.Test.PkBean> list = new List <Kinetix.Data.SqlClient.Test.PkBean>();
                PkBean b = new PkBean();
                b.Pk = 1;
                list.Add(b);
                TestDbProviderFactory.DefinedNextResult(list);

                OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean> store = new OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean>("test");
                TestStoreRule rule = new TestStoreRule("DataFloat");
                rule.InsertValue = new ValueRule(3, ActionRule.IncrementalUpdate);
                store.AddRule(rule);
                Assert.AreEqual(1, store.Put(new Kinetix.Data.SqlClient.Test.Bean()));
                Kinetix.Data.SqlClient.Test.TestDbCommand command = Kinetix.Data.SqlClient.Test.TestDbCommand.LastCommand;
                Assert.AreEqual("insert into BEAN(BEA_LONG, BEA_SHORT, BEA_GUID, BEA_FLOAT, BEA_DOUBLE, BEA_DECIMAL, BEA_DATETIME, BEA_CHARS, BEA_CHAR, BEA_BYTES, BEA_BYTE, BEA_BOOL, BEA_INT, BEA_STRING) values (:BEA_LONG, :BEA_SHORT, :BEA_GUID, :BEA_FLOAT, :BEA_DOUBLE, :BEA_DECIMAL, :BEA_DATETIME, :BEA_CHARS, :BEA_CHAR, :BEA_BYTES, :BEA_BYTE, :BEA_BOOL, :BEA_INT, :BEA_STRING)\nselect cast(SCOPE_IDENTITY() as int)", command.CommandText);
            }
        }
        public void TestUpdateWithWhereCheck()
        {
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                List <PkBean> list = new List <PkBean>();
                PkBean        b    = new PkBean();
                b.Pk = 1;
                list.Add(b);
                TestDbProviderFactory.DefinedNextResult(list);

                OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean> store = new OracleSqlStore <Kinetix.Data.SqlClient.Test.Bean>("test");
                TestStoreRule rule = new TestStoreRule("DataFloat");
                rule.WhereValue = new ValueRule(3, ActionRule.Check);
                store.AddRule(rule);
                Kinetix.Data.SqlClient.Test.Bean bean = new Kinetix.Data.SqlClient.Test.Bean();
                bean.Pk = 1;
                Assert.AreEqual(1, store.Put(bean));
                Kinetix.Data.SqlClient.Test.TestDbCommand command = Kinetix.Data.SqlClient.Test.TestDbCommand.LastCommand;
                Assert.IsTrue(command.CommandText.Contains("update BEAN set BEA_LONG = :BEA_LONG, BEA_SHORT = :BEA_SHORT, BEA_GUID = :BEA_GUID, BEA_FLOAT = :BEA_FLOAT, BEA_DOUBLE = :BEA_DOUBLE, BEA_DECIMAL = :BEA_DECIMAL, BEA_DATETIME = :BEA_DATETIME, BEA_CHARS = :BEA_CHARS, BEA_CHAR = :BEA_CHAR, BEA_BYTES = :BEA_BYTES, BEA_BYTE = :BEA_BYTE, BEA_BOOL = :BEA_BOOL, BEA_INT = :BEA_INT, BEA_STRING = :BEA_STRING where BEA_PK = :BEA_PK and BEA_FLOAT = :RU_BEA_FLOAT"));
                Assert.AreEqual(3, command.Parameters["RU_BEA_FLOAT"].Value);
            }
        }
 public void TestConstructeur()
 {
     OracleSqlStore <Bean> store = new OracleSqlStore <Bean>("test");
 }