Beispiel #1
0
        public void GetNextBatchNumberForGivenDayTestShouldReturnCorrectBatchNumber(string value, int expectedBatchNumber)
        {
            var date              = DateTime.Parse(value);
            var paths             = new string[] { "2020-09-22_2_dk.zip", "2020-09-22_3_dk.zip", "2020-09-22_4_dk.zip", "2020-09-23_2_dk.zip" };
            int actualBatchNumber = _fileInfoService.GetNextBatchNumberForGivenDay(paths, date);

            Assert.AreEqual(expectedBatchNumber, actualBatchNumber);
        }
Beispiel #2
0
 private void HandleZipFilesForOrigin(string originPostfix, DateTime packageBeginDateTime)
 {
     try
     {
         foreach (var _rootZipFilesFolder in _rootZipFilesFolders)
         {
             _currentZipFilesFolder = _fileSystem.JoinPaths(_rootZipFilesFolder, originPostfix.ToString());
             //We get rid of any files that has been created but not renamed. This would be the case if any exception occurred during creation of any zip file
             ClearTemporaryFiles(_currentZipFilesFolder);
             string[] paths            = _fileSystem.GetFilenamesFromDirectory(_currentZipFilesFolder);
             int      nextBatchNumber  = _zipFileInfoService.GetNextBatchNumberForGivenDay(paths, _currentDateTime);
             var      zipFilesContents = _packageBuilder.BuildPackageContentV2(packageBeginDateTime, originPostfix);
             CreateZipFiles(originPostfix, zipFilesContents, nextBatchNumber);
         }
     }
     catch (SecurityException e)
     {
         throw new SecurityException($"Failed to create zip files due to a detection of a security error.", e);
     }
     catch (Exception e)
     {
         throw new Exception($"Failed to create zip files for origin: {originPostfix} and date: {packageBeginDateTime}", innerException: e);
     }
 }