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); }
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; }
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); }
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); }
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)); }
public void EmptySql() { TestAdoOperation operation = new TestAdoOperation(); operation.Compile(); }
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)); }
public void EmptySql() { TestAdoOperation operation = new TestAdoOperation(); Assert.Throws<InvalidDataAccessApiUsageException>(() => operation.Compile()); }
public void EmptySql() { TestAdoOperation operation = new TestAdoOperation(); Assert.Throws <InvalidDataAccessApiUsageException>(() => operation.Compile()); }