public async Task<IDataItem> ReadNextAsync(ReadOutputByRef readOutput, CancellationToken cancellation)
        {
            try
            {
                if (reader == null)
                {
                    reader = new CsvReader(
                        await sourceStreamProvider.CreateReader(cancellation),
                        new CsvReaderConfiguration
                        {
                            TrimQuoted = configuration.TrimQuoted,
                            IgnoreUnquotedNulls = configuration.NoUnquotedNulls
                        });
                    header = ReadHeaderRow();
                }

                if (header == null)
                    return null;

                return await Task.Factory.StartNew<IDataItem>(ReadNext);
            }
            finally
            {
                readOutput.DataItemId = String.Format(CultureInfo.InvariantCulture,
                    Resources.DataItemIdFormat, sourceStreamProvider.Id, reader == null ? 0 : reader.Row);
            }
        }
 private static void ReadAndVerify(string inputFileName, CsvReaderConfiguration configuration, object[][] expectedRows)
 {
     using (var csvReader = new CsvReader(new StreamReader(inputFileName), configuration))
     {
         IReadOnlyList<object> row;
         while ((row = csvReader.Read()) != null)
         {
             Assert.IsTrue(csvReader.Row <= expectedRows.Length, TestResources.ExtraRowRead);
             CollectionAssert.AreEqual(expectedRows[csvReader.Row - 1], row.ToArray(), TestResources.InvalidRowRead);
         }
     }
 }