コード例 #1
0
        public void TestParseConstant()
        {
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                TestDbProviderFactory.DefinedNextResult(new List <Bean>());

                SqlServerCommand command = new SqlServerCommand("test", SqlResource.ResourceManager, "SqlTestConst");
                command.ExecuteReader();

                Assert.IsTrue(command.CommandText.Contains("'5' = 5"));

                command.Dispose();
            }
        }
コード例 #2
0
        public void TestParseCurrentUserId()
        {
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                TestDbProviderFactory.DefinedNextResult(new List <Bean>());

                SqlServerCommand command = new SqlServerCommand("test", SqlResource.ResourceManager, "SqlTestUserId");
                command.ExecuteReader();

                Assert.IsTrue(command.CommandText.Contains(":CURRENT_USER_ID IS NOT NULL"));

                command.Dispose();
            }
        }
コード例 #3
0
        public void TestParseConstantIf()
        {
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                TestDbProviderFactory.DefinedNextResult(new List <Bean>());

                AbstractSqlCommand command = new OracleClient.OracleSqlCommand("test", SqlResource.ResourceManager, "SqlTestConstIf");
                command.Parameters.AddWithValue("PAR1", 5);
                command.ExecuteReader();

                Assert.IsTrue(command.CommandText.Contains("1 = 1"));

                command.Dispose();
            }
        }