public void TestRecordSetFromBank() { var recordReader = new CsvRecordReader("USBank"); Stream s = TestUtils.RetrieveResource(testResource1); var oldRecords = recordReader.ReadFromStream(s, this.config); CCRecordSet recordSet = new CCRecordSet(oldRecords, config); int creditCount = oldRecords.Count(x => x.Amount < 0); Assert.AreEqual(creditCount, 1); try { recordSet.SerializeToFile(serializationOutput); Assert.IsTrue(File.Exists(serializationOutput)); CCRecordSet newRecordSet = CCRecordSet.FromFile(serializationOutput, config); CollectionAssert.AreEquivalent(recordSet.ToList(), newRecordSet.ToList()); } finally { if (File.Exists(serializationOutput)) { File.Delete(serializationOutput); } } }
public void TestValidChaseRecordFile() { var recordReader = new CsvRecordReader("Chase"); Stream s = TestUtils.RetrieveResource(chaseTestResource); List <CCRecord> records = recordReader.ReadFromStream(s, this.config); Assert.AreEqual(records[0].PredictedValues.Count(), 2); Assert.AreEqual(records.Count, 21); Assert.AreEqual(records.Sum(r => r.Amount), 631.83m); }
public void TestValidUSBankRecordFile() { var recordReader = new CsvRecordReader("USBank"); Stream s = TestUtils.RetrieveResource(testResource1); var records = recordReader.ReadFromStream(s, this.config); Assert.AreEqual(records[0].PredictedValues.Count(), 2); Assert.AreEqual(records[0].Amount, 8.88m); Assert.AreEqual(records[0].Description, "WHOLEFDS BKN, #10220 BROOKLYN NY"); // test commas }
public void TestUSBankRecordFileWithBadColumns() { var recordReader = new CsvRecordReader("USBank"); Stream s = TestUtils.RetrieveResource(testResource2); var records = recordReader.ReadFromStream(s, this.config).ToList(); }