public void CanDetectWestpac() { var westpac = new WestpacCsvImportDetector(); Assert.That(westpac.Name, Is.EqualTo("Westpac")); Assert.That(westpac.GetPropertyNames(), Is.EquivalentTo(new[] { "Analysis Code", "Description", "Other Party", "Particulars", "Reference" })); Assert.That(westpac.Matches(_wpFilename), Is.True); Assert.That(westpac.Matches(_asbFilename), Is.False); Assert.That(westpac.Matches(_wpVisaFilename), Is.False); }
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")); }