Esempio n. 1
0
        public void CanDetectArbitrary()
        {
            var wp = new WestpacCsvImportDetector();
            var asbOrbit = new AsbOrbitFastTrackCsvImportDetector();
            var asbVisa = new AsbVisaCsvImportDetector();
            var wpVisa = new WestpacVisaCsvImportDetector();

            var importDetector = new ImportDetector(new IImportDetector[] { wp, wpVisa, asbOrbit, asbVisa });
            Assert.That(importDetector.GetImportDetector(_wpFilename), Is.EqualTo(wp));
            Assert.That(importDetector.GetImportDetector(_asbFilename), Is.EqualTo(asbOrbit));
            Assert.That(importDetector.GetImportDetector(_wpVisaFilename), Is.EqualTo(wpVisa));
            Assert.That(importDetector.GetImportDetector(_asbVisaFilename), Is.EqualTo(asbVisa));
        }
Esempio n. 2
0
        public void CanNotImportBadFile()
        {
            var wp = new WestpacCsvImportDetector();
            var asb = new AsbOrbitFastTrackCsvImportDetector();
            var wpVisa = new WestpacVisaCsvImportDetector();
            var asbVisa = new AsbVisaCsvImportDetector();

            var importDetector = new ImportDetector(new IImportDetector[] { wp, asb, wpVisa, asbVisa });
            var import = new Import(importDetector);
            Assert.That(import.Open("bad.txt", Stream.Null), Is.False);
        }
Esempio n. 3
0
        public void CanImportArbitrary()
        {
            var wp = new WestpacCsvImportDetector();
            var asb = new AsbOrbitFastTrackCsvImportDetector();
            var wpVisa = new WestpacVisaCsvImportDetector();
            var asbVisa = new AsbVisaCsvImportDetector();

            var importDetector = new ImportDetector(new IImportDetector[] { wp, asb, wpVisa, asbVisa});
            var import = new Import(importDetector);

            Assert.That(import.Open(_wpFilename), Is.True);
            Assert.That(import.ImportType, Is.EqualTo(wp.Name));
            Assert.That(import.GetPropertyNames(), Is.EqualTo(wp.GetPropertyNames()));

            var data = import.GetData().ToArray();
            Assert.That(data, Is.Not.Empty);
            Assert.That(data.Last().Id, Is.EqualTo("A00_0000_0000000_000-12Aug12/18"));

            import = new Import(importDetector);
            Assert.That(import.Open(_asbFilename), Is.True);
            Assert.That(import.ImportType, Is.EqualTo(asb.Name));
            Assert.That(import.GetPropertyNames(), Is.EqualTo(asb.GetPropertyNames()));
            data = import.GetData().ToArray();
            Assert.That(data, Is.Not.Empty);
            Assert.That(data.Last().Id, Is.EqualTo("asb/2012082501"));

            import = new Import(importDetector);
            Assert.That(import.Open(_asbVisaFilename), Is.True);
            Assert.That(import.ImportType, Is.EqualTo(asbVisa.Name));
            Assert.That(import.GetPropertyNames(), Is.EqualTo(asbVisa.GetPropertyNames()));
            data = import.GetData().ToArray();
            Assert.That(data, Is.Not.Empty);
            Assert.That(data.Last().Id, Is.EqualTo("visa/2012101505"));

            import = new Import(importDetector);
            Assert.That(import.Open(_wpVisaFilename), Is.True);
            Assert.That(import.ImportType, Is.EqualTo(wpVisa.Name));
            Assert.That(import.GetPropertyNames(), Is.EqualTo(wpVisa.GetPropertyNames()));
            data = import.GetData().ToArray();
            Assert.That(data, Is.Not.Empty);
            Assert.That(data.Last().Id, Is.EqualTo("AXXXX_XXXX_XXXX_9623-01Apr12/64"));
        }
Esempio n. 4
0
        public void CanImportVisa()
        {
            var visa = new WestpacVisaCsvImportDetector();
            var import = visa.Import(_wpVisaFilename);

            Assert.That(import.Count(), Is.EqualTo(64));

            var row = import.Last();
            Assert.That(row.Date, Is.EqualTo(DateTime.Parse("2012-4-27")));
            Assert.That(row.Amount, Is.EqualTo(-1768.3M));
        }
Esempio n. 5
0
        public void CanDetectWestpacVisa()
        {
            var visa = new WestpacVisaCsvImportDetector();
            Assert.That(visa.Name, Is.EqualTo("Visa"));

            Assert.That(visa.Matches(_wpVisaFilename), Is.True);
            Assert.That(visa.Matches(_asbFilename), Is.False);
            Assert.That(visa.Matches(_wpFilename), Is.False);
        }