Esempio n. 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, "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)
                {
                    var isUnique = context.ReadConfigAsBool(bamValidationCol, "@isUnique", true);
                    var colName  = bamValidationCol.LocalName;
                    var colValue = bamValidationCol.InnerText;
                    var dctv     = new DBCellToValidate(colName, colValue);
                    if (isUnique)
                    {
                        drtv.AddUniqueCell(dctv);
                    }
                    else
                    {
                        drtv.AddCell(dctv);
                    }
                }

                DBRowsToValidate.AddRow(drtv);
            }

            Execute(context);
        }
Esempio n. 2
0
        public object[] FormatParameters(Type type, object[] args, Context ctx)
        {
            object[] retVal;

            if (typeof(DBRowsToValidate) == type)
            {
                object[] 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 DBRowsToValidate(argsFetchedFromCtx);
            }
            else
            {
                throw new ApplicationException(
                          string.Format("The type {0} is not supported in DBRowsToValidateParamFormatter", type.FullName));
            }

            return(retVal);
        }
Esempio n. 3
0
        public object[] FormatParameters(Type type, object[] args, Context ctx)
        {
            object[] retVal;

            if (typeof(DBRowsToValidate) == type)
            {
                object[] 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 DBRowsToValidate(argsFetchedFromCtx);
            }
            else
            {
                throw new ApplicationException(
                    string.Format("The type {0} is not supported in DBRowsToValidateParamFormatter", type.FullName));
            }

            return retVal;
        }
Esempio n. 4
0
 /// <summary>
 /// </summary>
 public DBQueryStep()
 {
     DBRowsToValidate = new DBRowsToValidate();
 }