Esempio n. 1
0
        public static PairwiseTestMatrix GenerateMatrixFromPictFile(string modelFile, PairwiseSettings settings)
        {
            if (modelFile == null)
            {
                throw new ArgumentNullException("modelFile");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            string[][]         results = null;
            PairwiseTestMatrix matrix  = new PairwiseTestMatrix();

            using (PictRunner pr = new PictRunner())
            {
                results = pr.AlwaysExecutePictOnFileName(modelFile, settings);
                matrix.PictExecutionInformation = pr.LastExecutionInformation;
            }

            string[]           headerFields = results[0];
            PairwiseTestCase[] cases        = new PairwiseTestCase[results.Length - 1];

            for (int tupleNo = 0; tupleNo < cases.Length; ++tupleNo)
            {
                string[] fields = results[tupleNo + 1];
                PairwiseTestParameter[] values = new PairwiseTestParameter[fields.Length];

                for (int field = 0; field < fields.Length; ++field)
                {
                    values[field] = new PairwiseTestParameter(headerFields[field], fields[field]);
                }

                cases[tupleNo] = new PairwiseTestCase(values);
            }

            // NOTE: sorting makes things easier to diff, kinda
            Array.Sort(cases, PairwiseTestCase.Comparer);
            matrix.PairwiseTestCases = cases;
            return(matrix);
        }
Esempio n. 2
0
        /// <summary>
        /// Genetate PairwiseTestCase array from a pict model file and optional arguments for pict.
        /// </summary>
        /// <param name="modelFile">model file</param>
        /// <param name="pictArgs">arguments for pict</param>
        /// <returns></returns>
        public static PairwiseTestCase[] GenerateTestsFromFile(string modelFile, string pictArgs)
        {
            PairwiseTestMatrix matrix = PairwiseTestMatrix.GenerateMatrixFromPictFile(modelFile, pictArgs);

            return(matrix.PairwiseTestCases);
        }