public override void Run(object context) { DbController dbc = new DbController(Connection); try { Product product = dbc.GetRandomProduct(); DataTable table = new DataTable(); Command.CommandText = DbDefault.GetInnerJoinSelectStatement( Relation.PRODUCT_CATEGORY, new long[] { product.ProductId }); DataAdapter.Fill(table); if (table.Columns.Count != (DbDefault.GetTableStructure(TableName.PRODUCT).Columns.Count + DbDefault.GetTableStructure(TableName.CATEGORY).Columns.Count)) { Fail("Number of returned columns is incorrect"); } ParseDataTable(table); } catch (Exception e) { Fail(e); } finally { base.Run(context); } }
public override void Run(object context) { DbController dbc = new DbController(Connection); try { Category category = dbc.GetRandomCategory(); Command.CommandText = DbDefault.GetInnerJoinSelectStatement( Relation.PRODUCT_CATEGORY, new long[] { category.CategoryId }); DataReader = Command.ExecuteReader(); if (DataReader.FieldCount != (DbDefault.GetTableStructure(TableName.PRODUCT).Columns.Count + DbDefault.GetTableStructure(TableName.CATEGORY).Columns.Count)) { Fail("Number of data fields returned is incorrect"); } } catch (Exception e) { Fail(e); } finally { base.Run(context); } }
public override void Run(object context) { DbController dbc = new DbController(Connection); try { Order order = dbc.GetRandomOrder(); Product product = dbc.GetRandomProduct(); DataSet dataset = new DataSet(); Command.CommandText = DbDefault.GetInnerJoinSelectStatement( Relation.ORDERDETAIL_ORDER, new long[] { order.OrderId }); Log(Command.CommandText); DataAdapter.Fill(dataset, "OrderDetail_Order"); Command.CommandText = DbDefault.GetInnerJoinSelectStatement( Relation.ORDERDETAIL_PRODUCT, new long[] { product.ProductId }); Log(Command.CommandText); DataAdapter.Fill(dataset, "OrderDetail_Product"); if (dataset.Tables["OrderDetail_Order"].Columns.Count != (DbDefault.GetTableStructure(TableName.ORDERDETAIL).Columns.Count + DbDefault.GetTableStructure(TableName.ORDERS).Columns.Count)) { Fail("Incorrect number of columns returned for joined OrderDetail_Order query"); } if (dataset.Tables["OrderDetail_Product"].Columns.Count != (DbDefault.GetTableStructure(TableName.ORDERDETAIL).Columns.Count + DbDefault.GetTableStructure(TableName.PRODUCT).Columns.Count)) { Fail("Incorrect number of columns returned for joined OrderDetail_Product query"); } ParseDataSet(dataset); } catch (Exception e) { Fail(e); } finally { base.Run(context); } }
public override void Run(object context) { DbController dbc = new DbController(Connection); try { DataSet ds = new DataSet(); Command.CommandText = DbDefault.GetInnerJoinSelectStatement( Relation.PRODUCT_CATEGORY, new long[] { dbc.GetRandomCategory().CategoryId }); DataAdapter.Fill(ds, "Product_Category"); Command.CommandText = DbDefault.GetInnerJoinSelectStatement( Relation.ORDER_CUSTOMER, new long[] { dbc.GetRandomCustomer().CustomerId }); DataAdapter.Fill(ds, "Order_Customer"); if (ds.Tables["Product_Category"].Columns.Count != (DbDefault.GetTableStructure(TableName.PRODUCT).Columns.Count + DbDefault.GetTableStructure(TableName.CATEGORY).Columns.Count)) { Fail("Number of returned columns is incorrect"); } if (ds.Tables["Order_Customer"].Columns.Count != (DbDefault.GetTableStructure(TableName.ORDERS).Columns.Count + DbDefault.GetTableStructure(TableName.CUSTOMER).Columns.Count)) { Fail("Number of returned columns is incorrect"); } } catch (Exception e) { Fail(e); } finally { base.Run(context); } }
public override void Run(object context) { String schemaName = DbHelper.GetRandomString(5); try { DbDefault.CreateDB(schemaName, DbCreateType.Basic); Command.CommandText = DbDefault.GetInnerJoinSelectStatement( schemaName, Relation.ORDER_CUSTOMER, null); DataTable dt = new DataTable(); Log(Command.CommandText); DataAdapter.Fill(dt); if (dt.Rows.Count <= 0) { Fail("Failed to perform join query"); } } catch (Exception e) { Fail(e); } finally { try { DbDefault.DropDB(schemaName); } catch (Exception e) { Log(e); } base.Run(context); } }