コード例 #1
0
        /// <summary>
        /// ITestStep.Execute() implementation
        /// </summary>
        /// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
        /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
        public void Execute(XmlNode testConfig, Context context)
        {
            _delayBeforeExecution = context.ReadConfigAsInt32(testConfig, "DelayBeforeExecution");
            _connectionString     = context.ReadConfigAsString(testConfig, "ConnectionString");
            _numberOfRowsAffected = testConfig.InnerXml.IndexOf("NumberOfRowsAffected", 0, testConfig.InnerXml.Length) != -1? context.ReadConfigAsInt32(testConfig, "NumberOfRowsAffected") : -1;
            XmlNode queryConfig = testConfig.SelectSingleNode("SQLQuery");

            _sqlQuery = SqlQuery.BuildSQLQuery(queryConfig, context);

            Execute(context);
        }
コード例 #2
0
        /// <summary>
        /// ITestStep.Execute() implementation
        /// </summary>
        /// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
        /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
        public void Execute(XmlNode testConfig, Context context)
        {
            _delayBeforeCheck = context.ReadConfigAsInt32(testConfig, "DelayBeforeCheck");
            _connectionString = context.ReadConfigAsString(testConfig, "ConnectionString");
            var queryConfig = testConfig.SelectSingleNode("SQLQuery");

            _sqlQuery             = SqlQuery.BuildSQLQuery(queryConfig, context);
            _numberOfRowsExpected = context.ReadConfigAsInt32(testConfig, "NumberOfRowsExpected", true);

            var rowCollection     = testConfig.SelectSingleNode("Rows");
            var bamValidationRows = rowCollection.SelectNodes("*");

            foreach (XmlNode bamValidationRow in bamValidationRows)
            {
                var drtv = new DBRowToValidate();

                var bamValidationCols = bamValidationRow.SelectNodes("*");
                foreach (XmlNode bamValidationCol in bamValidationCols)
                {
                    bool   isUnique = context.ReadConfigAsBool(bamValidationCol, "@isUnique", true);
                    string colName  = bamValidationCol.LocalName;
                    string colValue = bamValidationCol.InnerText;
                    var    dctv     = new DBCellToValidate(colName, colValue);
                    if (isUnique)
                    {
                        drtv.AddUniqueCell(dctv);
                    }
                    else
                    {
                        drtv.AddCell(dctv);
                    }
                }

                _dbRowsToValidate.AddRow(drtv);
            }

            Execute(context);
        }