Exemplo n.º 1
0
        public void CanDetectAsb()
        {
            var asb = new AsbOrbitFastTrackCsvImportDetector();
            Assert.That(asb.Name, Is.EqualTo("ASB Orbit FastTrack"));

            Assert.That(asb.Matches(_asbFilename), Is.True);
            Assert.That(asb.Matches(_wpFilename), Is.False);
            Assert.That(asb.Matches(_wpVisaFilename), Is.False);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
0
        public void CanImportAsbOrbitFastTrack()
        {
            var asb = new AsbOrbitFastTrackCsvImportDetector();
            var import = asb.Import(_asbFilename);

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

            var row = import.Last();
            Assert.That(row.Date, Is.EqualTo(DateTime.Parse("2012-8-25")));
            Assert.That(row.Amount, Is.EqualTo(-160M));
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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"));
        }