/// <summary>
        /// renaming helper method for mocking IMatrixData
        /// </summary>
        /// <param name="colnames"></param>
        /// <param name="pattern"></param>
        /// <param name="replacement"></param>
        private static string Rename(List <string> colnames, string pattern, string replacement)
        {
            RenameColumnsRegexp renamer = new RenameColumnsRegexp();
            Mock <IMatrixData>  matrix  = new Mock <IMatrixData>();

            matrix.Setup(m => m.ColumnCount).Returns(colnames.Count);
            matrix.Setup(m => m.ColumnNames).Returns(colnames);
            matrix.Setup(m => m.StringColumnNames).Returns(new List <string>());
            matrix.Setup(m => m.StringColumnCount).Returns(0);
            matrix.Setup(m => m.NumericColumnNames).Returns(new List <string>());
            matrix.Setup(m => m.NumericColumnCount).Returns(0);
            matrix.Setup(m => m.CategoryColumnNames).Returns(new List <string>());
            matrix.Setup(m => m.CategoryColumnCount).Returns(0);
            matrix.Setup(m => m.MultiNumericColumnNames).Returns(new List <string>());
            matrix.Setup(m => m.MultiNumericColumnCount).Returns(0);
            string     err   = "";
            Parameters param = renamer.GetParameters(matrix.Object, ref err);

            param.GetParamWithSubParams <int>("Column type").GetSubParameters()
            .GetParam <Tuple <Regex, string> >("Regex").Value = Tuple.Create(new Regex(pattern), replacement);
            IMatrixData[]   supplTables = null;
            IDocumentData[] documents   = null;
            var             pInfo       = new ProcessInfo(new Settings(), s => { }, i => { }, 1);

            renamer.ProcessData(matrix.Object, param, ref supplTables, ref documents, pInfo);
            return(pInfo.ErrString);
        }
Esempio n. 2
0
        /// <summary>
        /// renaming helper method for mocking IMatrixData
        /// </summary>
        /// <param name="colnames"></param>
        /// <param name="pattern"></param>
        /// <param name="replacement"></param>
        private static void Rename(List <string> colnames, string pattern, string replacement)
        {
            var renamer = new RenameColumnsRegexp();
            var matrix  = new Moq.Mock <IMatrixData>();

            matrix.Setup(m => m.ColumnCount).Returns(colnames.Count);
            matrix.Setup(m => m.ColumnNames).Returns(colnames);
            string err   = "";
            var    param = renamer.GetParameters(matrix.Object, ref err);

            param.GetParam <Tuple <Regex, string> >("Regex").Value = Tuple.Create(new Regex(pattern), replacement);
            IMatrixData[]   supplTables = null;
            IDocumentData[] documents   = null;
            renamer.ProcessData(matrix.Object, param, ref supplTables, ref documents, null);
        }