示例#1
0
        public override void Run(object context)
        {
            GFXDCommand command;
            String      cmdString = "SELECT * FROM " + DbDefault.GetAddressQuery();

            try
            {
                command = new GFXDCommand(cmdString, Connection);

                if (command.CommandText != cmdString)
                {
                    Fail(String.Format(
                             "CommandText property is not initialized with specified "
                             + " command string. Expected {0}; Actual {1}",
                             cmdString, command.CommandText));
                }
                if (command.Connection != Connection)
                {
                    Fail(String.Format(
                             "Connection property is not initialized with the specified "
                             + "GFXDConnection object"));
                }
            }
            catch (Exception e)
            {
                Fail(e);
            }
            finally
            {
                base.Run(context);
            }
        }
        public override void Run(object context)
        {
            DataSet dataset   = new DataSet();
            String  tableName = TableName.PRODUCT.ToString();

            Command.CommandText = DbDefault.GetAddressQuery();
            int count = 0;

            try
            {
                DataAdapter = Command.CreateDataAdapter();
                dataset     = new DataSet();

                // fill product table
                DataAdapter.SelectCommand.CommandText = DbDefault.GetProductQuery();
                DataAdapter.Fill(dataset, tableName);

                if (dataset.Tables.Count != 1)
                {
                    Fail(String.Format("Tables.Count is incorrect. "
                                       + "Expected [{0}]; Actual [{1}]",
                                       count, dataset.Tables.Count));
                }
                if (dataset.Tables[0].TableName != tableName)
                {
                    Fail(String.Format("TableName is incorrect. "
                                       + "Expected [{0}]; Actual [{1}]",
                                       tableName, dataset.Tables[0].TableName));
                }
                if (dataset.Tables[0].Columns.Count <= 0)
                {
                    Fail(String.Format("Table has {0} columns",
                                       dataset.Tables[0].Columns.Count));
                }
                if (dataset.Tables[0].Rows.Count <= 0)
                {
                    Fail(String.Format("Table has {0} rows",
                                       dataset.Tables[0].Rows.Count));
                }

                ParseDataSet(dataset);
            }
            catch (Exception e)
            {
                Fail(e);
            }
            finally
            {
                base.Run(context);
            }
        }
        public override void Run(object context)
        {
            GFXDCommand command;
            String      cmdString = "SELECT * FROM " + DbDefault.GetAddressQuery();

            try
            {
                command = new GFXDCommand(cmdString, Connection);

                if (command.CommandText != cmdString)
                {
                    Fail(String.Format(
                             "CommandText property is not initialized with specified "
                             + " command string. Expected {0}; Actual {1}",
                             cmdString, command.CommandText));
                }
                if (command.Connection != Connection)
                {
                    Fail(String.Format(
                             "Connection property is not initialized with the specified "
                             + "GFXDConnection object"));
                }
                if (command.CommandTimeout != -1)
                {
                    Fail(String.Format(
                             "CommandTimeout default setting is incorrect. "
                             + "Expected [{0}]; Actual [{1}]",
                             -1, command.CommandTimeout));
                }
                if (command.CommandType != System.Data.CommandType.Text)
                {
                    Fail(String.Format(
                             "CommandType default setting is incorrect. "
                             + "Expected [{0}]; Actual [{1}]",
                             System.Data.CommandType.Text, command.CommandType));
                }
                if (command.FetchSize != 0)
                {
                    Fail(String.Format(
                             "FetchSize default setting is incorrect. "
                             + "Expected [{0}]; Actual [{1}]",
                             0, command.FetchSize));
                }
                // CHANGED if (command.ReaderHoldOverCommit != false)
                //{
                //    Fail(String.Format(
                //        "ReaderHoldOverCommit default setting is incorrect. "
                //        + "Expected [{0}]; Actual [{1}]",
                //        false, command.ReaderHoldOverCommit));
                //}
                if (command.ReaderType != GFXDCommand.DataReaderType.ForwardOnly)
                {
                    Fail(String.Format(
                             "ReaderType default setting is incorrect. "
                             + "Expected [{0}]; Actual [{1}]",
                             GFXDCommand.DataReaderType.ForwardOnly, command.ReaderType));
                }
                // CHANGED if (command.ReaderUpdatable != false)
                //{
                //    Fail(String.Format(
                //        "ReaderUpdatable default setting is incorrect. "
                //        + "Expected [{0}]; Actual [{1}]",
                //        false, command.ReaderUpdatable));
                //}
            }
            catch (Exception e)
            {
                Fail(e);
            }
            finally
            {
                base.Run(context);
            }
        }
        public override void Run(object context)
        {
            GFXDDataAdapter adapter = null;

            Command.CommandText = DbDefault.GetAddressQuery();

            try
            {
                adapter = new GFXDDataAdapter(Command);

                if (adapter.SelectCommand != Command)
                {
                    Fail("SelectCommand does not reference Command object.");
                }
                if (adapter.SelectCommand.CommandText != Command.CommandText)
                {
                    Fail("SelectCommand.CommandText does not reference Command.CommandText");
                }
                if (adapter.SelectCommand.Connection != Connection)
                {
                    Fail("SelectCommand.Connection does not reference Connection object");
                }
                if (!adapter.AcceptChangesDuringFill)
                {
                    Fail(String.Format("AcceptChangesDuringFill: "
                                       + "Expected [{0}]; Actual [{1}]",
                                       true, adapter.AcceptChangesDuringFill));
                }
                if (!adapter.AcceptChangesDuringUpdate)
                {
                    Fail(String.Format("AcceptChangesDuringUpdate: "
                                       + "Expected [{0}]; Actual [{1}]",
                                       true, adapter.AcceptChangesDuringUpdate));
                }
                if (adapter.ContinueUpdateOnError)
                {
                    Fail(String.Format("ContinueUpdateOnError: "
                                       + "Expected [{0}]; Actual [{1}]",
                                       false, adapter.ContinueUpdateOnError));
                }
                if (adapter.FillLoadOption != LoadOption.OverwriteChanges)
                {
                    Fail(String.Format("FillLoadOption: "
                                       + "Expected [{0}]; Actual[{1}]",
                                       LoadOption.OverwriteChanges, adapter.FillLoadOption));
                }
                if (adapter.MissingMappingAction != MissingMappingAction.Passthrough)
                {
                    Fail(String.Format("MissingMappingAction: "
                                       + "Expected [{0}]; Actual [{1}]",
                                       MissingMappingAction.Passthrough, adapter.MissingMappingAction));
                }
                if (adapter.MissingSchemaAction != MissingSchemaAction.Add)
                {
                    Fail(String.Format("MissingSchemaAction: "
                                       + "Expected [{0}]; Actual [{1}]",
                                       MissingSchemaAction.Add, adapter.MissingSchemaAction));
                }
                if (adapter.ReturnProviderSpecificTypes)
                {
                    Fail(String.Format("ReturnProviderSpecificTypes: "
                                       + "Expected [{0}]; Actual [{1}]",
                                       false, adapter.ReturnProviderSpecificTypes));
                }
                if (adapter.UpdateBatchSize != 1)
                {
                    Fail(String.Format("UpdateBatchSize: "
                                       + "Expected [{0}]; Actual [{1}]",
                                       1, adapter.UpdateBatchSize));
                }
            }
            catch (Exception e)
            {
                Fail(e);
            }
            finally
            {
                base.Run(context);
            }
        }
示例#5
0
        public override void Run(object context)
        {
            DataSet dataset = new DataSet();

            Command.CommandText = DbDefault.GetAddressQuery();
            int count = 0;

            try
            {
                // fill address table
                DataAdapter.Fill(dataset, TableName.ADDRESS.ToString());
                count++;

                // fill supplier table
                DataAdapter.SelectCommand.CommandText = DbDefault.GetSupplierQuery();
                DataAdapter.Fill(dataset, TableName.SUPPLIER.ToString());
                count++;

                // fill category table
                DataAdapter.SelectCommand.CommandText = DbDefault.GetCategoryQuery();
                DataAdapter.Fill(dataset, TableName.CATEGORY.ToString());
                count++;

                // fill product table
                DataAdapter.SelectCommand.CommandText = DbDefault.GetProductQuery();
                DataAdapter.Fill(dataset, TableName.PRODUCT.ToString());
                count++;

                // fill customer table
                DataAdapter.SelectCommand.CommandText = DbDefault.GetCustomerQuery();
                DataAdapter.Fill(dataset, TableName.CUSTOMER.ToString());
                count++;

                // fill order table
                DataAdapter.SelectCommand.CommandText = DbDefault.GetOrderQuery();
                DataAdapter.Fill(dataset, TableName.ORDERS.ToString());
                count++;

                // fill orderdetail table
                DataAdapter.SelectCommand.CommandText = DbDefault.GetOrderDetailQuery();
                DataAdapter.Fill(dataset, TableName.ORDERDETAIL.ToString());
                count++;

                if (dataset.Tables.Count != count)
                {
                    Fail(String.Format("Tables.Count is incorrect. "
                                       + "Expected {0}; Actual {1}",
                                       count, dataset.Tables.Count));
                }

                foreach (DataTable table in dataset.Tables)
                {
                    if (table.Columns.Count <= 0)
                    {
                        Fail(String.Format("Table [{0}] has {1} columns",
                                           table.TableName, table.Columns.Count));
                    }
                    if (table.Rows.Count <= 0)
                    {
                        Fail(String.Format("Table [{0}] has {1} rows",
                                           table.TableName, table.Rows.Count));
                    }
                }

                ParseDataSet(dataset);
            }
            catch (Exception e)
            {
                Fail(e);
            }
            finally
            {
                base.Run(context);
            }
        }