public FileValidationProvider(IFileCompressionService fileCompressionService, IFileReaderService fileReaderService, IStatsFileParserService statsFileParserService) { this.fileCompressionService = fileCompressionService; this.fileReaderService = fileReaderService; this.statsFileParserService = statsFileParserService; }
private async void DecompressButton_Click(object sender, EventArgs e) { await RunActionAsync(() => { string decompressDirectory = DecompressDirectoryTextBox.Text; if (!Directory.Exists(decompressDirectory)) { Log( $"The directory does not exist, provide a new directory and try again. Directory: '{decompressDirectory}'"); return(Task.CompletedTask); } string[] importFiles = Directory.GetFiles(decompressDirectory, "*.bz2", SearchOption.TopDirectoryOnly); if (importFiles.Length == 0) { Log( $"There are no text files in the top directory, provide a directory with files to decompress and try again. Directory: '{decompressDirectory}'"); return(Task.CompletedTask); } int filesRemaining = importFiles.Length; IFileCompressionService fileCompressionService = null; try { fileCompressionService = WindsorContainer.Instance.Resolve <IFileCompressionService>(); Log($"'{filesRemaining}' files are to be imported"); foreach (string importFile in importFiles) { fileCompressionService.DecompressFile(importFile, importFile.Substring(importFile.Length - 4, 4)); filesRemaining--; Log($"File imported. '{filesRemaining}' remaining files to be imported"); } } finally { WindsorContainer.Instance.Release(fileCompressionService); } return(Task.CompletedTask); }); }
public void SetUp() { loggingServiceMock = Substitute.For <ILoggingService>(); validatorMock = Substitute.For <ICommandLineArgumentsValidatorService>(); legacyDbDumpReaderMock = Substitute.For <ILegacyDbDumpReaderService>(); dataMappingServiceMock = Substitute.For <IDataMappingService>(); fileSystemOperationsServiceMock = Substitute.For <IFileSystemOperationsService>(); statsDataWriterMock = Substitute.For <IStatsDataWriterService>(); fileCompressionServiceMock = Substitute.For <IFileCompressionService>(); systemUnderTest = new MigratorProvider( loggingServiceMock, validatorMock, legacyDbDumpReaderMock, dataMappingServiceMock, fileSystemOperationsServiceMock, statsDataWriterMock, fileCompressionServiceMock); }
public MigratorProvider( ILoggingService loggingService, ICommandLineArgumentsValidatorService inputValidator, ILegacyDbDumpReaderService legacyDbDumpReader, IDataMappingService dataMappingService, IFileSystemOperationsService fileSystemOperationsService, IStatsDataWriterService statsDataWriter, IFileCompressionService fileCompressionService) { this.loggingService = loggingService; this.inputValidator = inputValidator; this.legacyDbDumpReader = legacyDbDumpReader; this.legacyDbDumpReader.RecordsForDayRead += LegacyDbDumpReader_RecordsForDayRead; this.dataMappingService = dataMappingService; this.fileSystemOperationsService = fileSystemOperationsService; this.statsDataWriter = statsDataWriter; this.fileCompressionService = fileCompressionService; }
public TestHarnessFileCompressionProvider(IFileCompressionService innerService, ITestHarnessSettingsService settingsService) { this.innerService = innerService; this.settingsService = settingsService; }