public async Task ReadMalformedDocuments_MalformedDataIgnored() { var configuration = Mocks .Of <ICsvFileSourceAdapterConfiguration>(c => c.Files == new[] { @"InputData\MalformedTest.csv" }) .First(); var records = await CsvFileHelper.ReadCsv(configuration); Assert.AreEqual(5, records.Count, TestResources.UnexpectedRecordsProcessed); Assert.AreEqual(6, records[0].GetFieldNames().Count(), TestResources.UnexpectedFieldsProcessed); }
public async Task ReadNestedDocuments_AllDataRead() { const string NestedDocumentFieldName = "Manager"; var configuration = Mocks .Of <ICsvFileSourceAdapterConfiguration>(c => c.Files == new[] { @"InputData\NestedDocumentsTest.csv" } && c.NestingSeparator == ".") .First(); var records = await CsvFileHelper.ReadCsv(configuration); Assert.AreEqual(4, records.Count, TestResources.UnexpectedRecordsProcessed); var fields = records[0].GetFieldNames().ToArray(); Assert.AreEqual(6, fields.Count(), TestResources.UnexpectedFieldsProcessed); CollectionAssert.Contains(fields, NestedDocumentFieldName, TestResources.NestedDocumentFieldNotProcessed); var nestedDocument = records[0].GetValue(NestedDocumentFieldName) as IDataItem; Assert.IsNotNull(nestedDocument, TestResources.NestedDocumentFieldNotProcessed); Assert.AreEqual(2, nestedDocument.GetFieldNames().Count(), TestResources.UnexpectedFieldsProcessed); }