public void CanParseProduceFile() { var parser = new ProduceFileParser(); ProduceItem firstItem = null; var totalItems = 0; foreach(var item in parser.Parse(@".\Data\produce.csv")) { if (firstItem == null) firstItem = item; totalItems++; } Assert.That(totalItems, Is.EqualTo(12)); Assert.That(firstItem.SupplierId, Is.EqualTo(15)); Assert.That(firstItem.ProductCode, Is.EqualTo(1101)); Assert.That(firstItem.ProductDescription, Is.EqualTo("Apples 1kg Golden Delicious. The sweetest Apples! Always a favourite. Love, Mrs. Hollingberry")); Assert.That(firstItem.DeliveryDate, Is.EqualTo(new DateTime(2012,02,15))); Assert.That(firstItem.UnitPrice, Is.EqualTo(15.05)); Assert.That(firstItem.NumberOfUnits, Is.EqualTo(5)); }
public void CanParseProduceFile() { var parser = new ProduceFileParser(); ProduceItem firstItem = null; var totalItems = 0; foreach (var item in parser.Parse(@".\Data\produce.csv")) { if (firstItem == null) { firstItem = item; } totalItems++; } Assert.That(totalItems, Is.EqualTo(12)); Assert.That(firstItem.SupplierId, Is.EqualTo(15)); Assert.That(firstItem.ProductCode, Is.EqualTo(1101)); Assert.That(firstItem.ProductDescription, Is.EqualTo("Apples 1kg Golden Delicious. The sweetest Apples! Always a favourite. Love, Mrs. Hollingberry")); Assert.That(firstItem.DeliveryDate, Is.EqualTo(new DateTime(2012, 02, 15))); Assert.That(firstItem.UnitPrice, Is.EqualTo(15.05)); Assert.That(firstItem.NumberOfUnits, Is.EqualTo(5)); }