コード例 #1
0
 public void DeclareParameterAfterCompile()
 {
     TestAdoOperation operation = new TestAdoOperation();
     operation.DbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
     operation.Sql = "select * from table";
     operation.Compile();
     IDbParameters parameters = new DbParameters(operation.DbProvider);
     Assert.Throws<InvalidDataAccessApiUsageException>(() => operation.DeclaredParameters = parameters);
 }
コード例 #2
0
 public void DeclareParameterAfterCompile()
 {
     TestAdoOperation operation = new TestAdoOperation();
     operation.DbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
     operation.Sql = "select * from table";
     operation.Compile();
     IDbParameters parameters = new DbParameters(operation.DbProvider);
     operation.DeclaredParameters = parameters;
 }
コード例 #3
0
 public void TooFewParameters()
 {
     TestAdoOperation operation = new TestAdoOperation();
     operation.DbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
     operation.Sql = "select * from table";
     IDbParameters parameters = new DbParameters(operation.DbProvider);
     parameters.Add("name");
     operation.DeclaredParameters = parameters;
     operation.Compile();
     operation.ValidateParams(null);
 }
コード例 #4
0
        public void DeclareParameterAfterCompile()
        {
            TestAdoOperation operation = new TestAdoOperation();

            operation.DbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
            operation.Sql        = "select * from table";
            operation.Compile();
            IDbParameters parameters = new DbParameters(operation.DbProvider);

            Assert.Throws <InvalidDataAccessApiUsageException>(() => operation.DeclaredParameters = parameters);
        }
コード例 #5
0
        public void TooFewParameters()
        {
            TestAdoOperation operation = new TestAdoOperation();

            operation.DbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
            operation.Sql        = "select * from table";
            IDbParameters parameters = new DbParameters(operation.DbProvider);

            parameters.Add("name");
            operation.DeclaredParameters = parameters;
            operation.Compile();
            Assert.Throws <InvalidDataAccessApiUsageException>(() => operation.ValidateParams(null));
        }
コード例 #6
0
        public void EmptySql()
        {
            TestAdoOperation operation = new TestAdoOperation();

            operation.Compile();
        }
コード例 #7
0
 public void TooFewParameters()
 {
     TestAdoOperation operation = new TestAdoOperation();
     operation.DbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
     operation.Sql = "select * from table";
     IDbParameters parameters = new DbParameters(operation.DbProvider);
     parameters.Add("name");
     operation.DeclaredParameters = parameters;
     operation.Compile();
     Assert.Throws<InvalidDataAccessApiUsageException>(() => operation.ValidateParams(null));
 }
コード例 #8
0
 public void EmptySql()
 {
     TestAdoOperation operation = new TestAdoOperation();
     Assert.Throws<InvalidDataAccessApiUsageException>(() => operation.Compile()); 
 }
コード例 #9
0
 public void EmptySql()
 {
     TestAdoOperation operation = new TestAdoOperation();
     operation.Compile();           
 }
コード例 #10
0
        public void EmptySql()
        {
            TestAdoOperation operation = new TestAdoOperation();

            Assert.Throws <InvalidDataAccessApiUsageException>(() => operation.Compile());
        }