public object[] FormatParameters(Type type, object[] args, Context ctx)
        {
            object[] retVal;

            if (typeof(SqlQuery) == type)
            {
                var argsFetchedFromCtx = new object[args.Length];
                int c = 0;
                foreach(object arg in args)
                {
                    argsFetchedFromCtx[c++] = ctx.ReadArgument(arg);
                }

                retVal = new object[1];
                retVal[0] = new SqlQuery(argsFetchedFromCtx);
            }
            else
            {
                throw new ApplicationException(
                    string.Format("The type {0} is not supported in SqlQueryParamFormatter", type.FullName));
            }

            return retVal;
        }
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);
		}
        /// <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);
		}