public void AttachmentTest2() { for (int x = 0; x < 2; x++) { for (int y = 0; y < 1000; y++) { string[] fields = null; var lines = File.ReadLines(Path.Combine(Directory.GetCurrentDirectory(), "attach.csv")); int lineCount = File.ReadAllLines(Path.Combine(Directory.GetCurrentDirectory(), "attach.csv")).Length; if (y > lineCount - 1) { break; } var line = new List <string>(lines)[y]; TextFieldParser parser = new TextFieldParser(new StringReader(line)); parser.HasFieldsEnclosedInQuotes = true; parser.SetDelimiters(","); fields = parser.ReadFields(); using (Attachment attachment = new Attachment(x == 0 ? _legacySourcePath : _modernSourcePath)) { if (fields[0].Length > 0) { attachment.AddFilterCriteria(Attachment.AttachmentFields.AttachmentRecd, ComparisonType.EqualTo, fields[0]); } if (fields[1].Length > 0) { attachment.AddFilterCriteria(Attachment.AttachmentFields.AttachmentFileName, ComparisonType.EqualTo, fields[1]); } if (fields[2].Length > 0) { attachment.AddFilterCriteria(Attachment.AttachmentFields.AttachmentDescription, ComparisonType.EqualTo, fields[2]); } if (fields[3].Length > 0) { attachment.AddFilterCriteria(Attachment.AttachmentFields.AttachmentParentis, ComparisonType.EqualTo, Convert.ToInt32(fields[3])); } if (fields[4].Length > 0) { attachment.AddFilterCriteria(Attachment.AttachmentFields.AttachmentParent, ComparisonType.EqualTo, Convert.ToInt32(fields[4])); } var attachmentList = attachment.AttachmentList(); if (attachmentList.Count == 0) { Assert.Fail("Match failed on line: " + (y + 1).ToString()); } } } } Assert.IsTrue(true, "AttachmentTest2 Passed!!"); }