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); } }
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); } } }