Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        /// <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!");
            }
        }