public void TestCreateIdxForDestinationNotExisting() { //Arrange XmlAccountConfig accountConfig = new XmlAccountConfig(@"c:\NotfallImporter\AccountConfig.xml", _fileHandler); XmlIdxIndexSpecification indexSpecification = new XmlIdxIndexSpecification(@"c:\NotfallImporter\IdxIndexSpezifikation.xml", _fileHandler); IdxBuilder idxBuilder = new IdxBuilder(accountConfig, indexSpecification); Action a = () => idxBuilder.BuildIdx(new ExportFile(_fileHandler.FileSys.FileInfo.FromFileName(@"c:\NotfallImporter\Error\vmi_20190304121156_99998_0000798569_0170631125_0123456789.zip"))); //Act and Assert Assert.Throws <DirectoryNotFoundException>(a); }
public void TestCreateIdx() { //Arrange XmlAccountConfig accountConfig = new XmlAccountConfig(@"c:\NotfallImporter\AccountConfig.xml", _fileHandler); XmlIdxIndexSpecification indexSpecification = new XmlIdxIndexSpecification(@"c:\NotfallImporter\IdxIndexSpezifikation.xml", _fileHandler); IdxBuilder idxBuilder = new IdxBuilder(accountConfig, indexSpecification, _fileHandler); //Act IdxRepresentation idx = idxBuilder.BuildIdx(new ExportFile(_fileHandler.FileSys.FileInfo.FromFileName(@"c:\NotfallImporter\Error\vmi_20190304121156_99998_0000798569_0170631125_0123456789.zip"))); //Assert Assert.True(_fileHandler.FileSys.File.Exists(@"c:\NotfallImporter\Import\vmi_20190304121156_99998_0000798569_0170631125_0123456789.idx")); string idxText = _fileHandler.FileSys.File.ReadAllText(@"c:\NotfallImporter\Import\vmi_20190304121156_99998_0000798569_0170631125_0123456789.idx"); Assert.Equal("99998;200\r\n", idxText); }
/// <summary> /// starts the import of the file /// </summary> /// <param name="sourceFile">source-File</param> public void Start(ExportFile sourceFile) { ExportFile exportedFile = new ExportFile(exportFile(sourceFile)); exportedFile.Data = sourceFile.Data; try { _idxBuilder.BuildIdx(exportedFile); _fileHandler.CreateReadyFile(exportedFile.File); _fileHandler.BackupFile(sourceFile.File, ExportModel.BackupDirectory); Messenger?.SendMessage($"{sourceFile.File.Name} exported!"); }catch (Exception e) { Messenger?.SendMessage($"Export of File {sourceFile.File.Name} failed!"); } }