Ejemplo n.º 1
0
        public void ReportRowError(RowValidationError error)
        {
            foreach (ValidationError rowSpecificErrors in error.Errors)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write(string.Format("[Error] ", error.Row));
                Console.ResetColor();

                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.Write(string.Format("line {1} character {0} ", rowSpecificErrors.AtCharacter, error.Row));
                Console.ResetColor();
                Console.Write(rowSpecificErrors.Message);
                Console.Write(Environment.NewLine);
            }
        }
Ejemplo n.º 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);
                }
            }
        }