public void Test001WhenOnlyOneEntryItGetsParsedCorrectly() { CSVPaymentFile csv = CSV(forFile: "american_oneline"); Payment expected = new Payment(new CreditCard("american"), "c1", new DateTime(2015, 10, 2), dues: 12, amount: 1200); IList <Payment> readPayments = csv.Read(); Assert.AreEqual(1, readPayments.Count, "There should only be one credit card entry"); Assert.AreEqual(expected, readPayments[0], "Payments are not equal"); }
public void Test003WhenReadingACashExpenseItGetsParsedCorrectly() { CSVPaymentFile csv = CSV(forFile: "cash_oneline"); IList <Payment> expected = new List <Payment>(); expected.Add(new Payment(new Cash(), "c1", new DateTime(2015, 10, 02), 1200)); IList <Payment> obtained = csv.Read(); AssertEqualLists(expected, obtained); }
public void Test002WhenMoreThanAnEntryExistsItsGetsParsedCorrectly() { CSVPaymentFile csv = CSV(forFile: "american_multiline"); IList <Payment> expected = new List <Payment>(); expected.Add(new Payment(new CreditCard("american"), "c1", new DateTime(2015, 10, 02), 12, 1200)); expected.Add(new Payment(new CreditCard("visa"), "c2", new DateTime(2015, 10, 01), 1, 200)); expected.Add(new Payment(new CreditCard("american"), "c3", new DateTime(2015, 10, 03), 3, 115.3)); IList <Payment> obtained = csv.Read(); Assert.AreEqual(3, obtained.Count, "There should be 3 credit card entries"); AssertEqualLists(expected, obtained); }