/// <summary>
        /// Validate the provided <paramref name="reader" />.
        /// </summary>
        /// <param name="reader">The data source to validate</param>
        /// <returns>An enumerable of <see cref="ColumnValidationError" /> </returns>
        public IEnumerable <ColumnValidationError> ValidateCols(ISourceReader reader)
        {
            foreach (string line in reader.ReadLines(_rowSeperator))
            {
                Header = _rowValidator.GetHeader(line);

                if (!_colValidator.IsValid(line))
                {
                    ColumnValidationError error = _colValidator.GetError();
                    _colValidator.ClearErrors();

                    yield return(error);
                }

                break; // only process the first line
            }
        }
Exemple #2
0
        public IEnumerable <RowValidationError> Validate(ISourceReader reader)
        {
            foreach (string line in reader.ReadLines(_rowSeperator))
            {
                _totalRowsChecked++;

                if (IsHeaderRow())
                {
                }
                else if (!_rowValidator.IsValid(line))
                {
                    RowValidationError error = _rowValidator.GetError();
                    error.Row = _totalRowsChecked;
                    _rowValidator.ClearErrors();

                    yield return(error);
                }
            }
        }