public void Build_CommandTypeSetToStoredProcedure_CommandTypeSetStoredProcedure() { var conn = new DbClient(DbProviderFactories.GetFactory("System.Data.OleDb"), typeof(OleDbConnection), ConnectionStringReader.GetOleDbSql()); var query = Mock.Of <IQuery>( x => x.ConnectionString == ConnectionStringReader.GetOleDbSql() && x.CommandType == System.Data.CommandType.StoredProcedure ); var factory = new OleDbCommandFactory(); var cmd = factory.Instantiate(conn, query, null); Assert.IsInstanceOf <OleDbCommand>(cmd.Implementation); Assert.That((cmd.Implementation as OleDbCommand).CommandType, Is.EqualTo(System.Data.CommandType.StoredProcedure)); }
public void Build_TimeoutSetTo30_TimeoutSet30Seconds() { var conn = new DbClient(DbProviderFactories.GetFactory("System.Data.OleDb"), typeof(OleDbConnection), ConnectionStringReader.GetOleDbSql()); var query = Mock.Of <IQuery>( x => x.ConnectionString == ConnectionStringReader.GetOleDbSql() && x.Statement == "WAITFOR DELAY '00:00:15'" && x.Timeout == new TimeSpan(0, 0, 30) ); var factory = new OleDbCommandFactory(); var cmd = factory.Instantiate(conn, query, null); Assert.IsInstanceOf <OleDbCommand>(cmd.Implementation); Assert.That((cmd.Implementation as OleDbCommand).CommandTimeout, Is.EqualTo(30)); }