コード例 #1
0
ファイル: CCRecordSetTests.cs プロジェクト: natesternberg/C3
        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);
                }
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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
        }
コード例 #4
0
 public void TestUSBankRecordFileWithBadColumns()
 {
     var    recordReader = new CsvRecordReader("USBank");
     Stream s            = TestUtils.RetrieveResource(testResource2);
     var    records      = recordReader.ReadFromStream(s, this.config).ToList();
 }