Example #1
0
        public DBRowsToValidate(object[] validationArgs)
        {
            ArgumentValidation.CheckForNullReference(validationArgs, "validationArgs");
            if (validationArgs.Length == 0)
            {
                throw new ArgumentException(
                          "The array objParams must be contain at least two objects, i.e. a column name and an expected value");
            }

            var drtv = new DBRowToValidate();

            for (int c = 0; c < validationArgs.Length; c += 2)
            {
                drtv.AddCell(new DBCellToValidate((string)validationArgs[c], (string)validationArgs[c + 1]));
            }
            _rowsToValidate.Add(drtv);
        }
Example #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);
        }
Example #3
0
 public void AddRow(DBRowToValidate dbRowToValidate)
 {
     _rowsToValidate.Add(dbRowToValidate);
 }
Example #4
0
        public DBRowsToValidate(object[] validationArgs)
        {
            ArgumentValidation.CheckForNullReference(validationArgs, "validationArgs");
            if (validationArgs.Length == 0)
            {
                throw new ArgumentException(
                    "The array objParams must be contain at least two objects, i.e. a column name and an expected value");
            }

            var drtv = new DBRowToValidate();
            for (int c = 0; c < validationArgs.Length; c += 2 )
            {
                drtv.AddCell(new DBCellToValidate((string)validationArgs[c], (string)validationArgs[c + 1]));    
            }
            _rowsToValidate.Add(drtv);
        }
Example #5
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);
		}
Example #6
0
 public void AddRow(DBRowToValidate dbRowToValidate)
 {
     _rowsToValidate.Add(dbRowToValidate);
 }