/// <summary> /// Initializes a new instance of the <see cref="QueueIntegrationImportCommandHandler"/> class. /// </summary> public QueueIntegrationImportCommandHandler( IDataContext dataContext, IFileInfoFactory fileInfoFactory, IQueryHandler <HashFileQuery, HashFileQueryResult> queryHandler, ICommandHandler <WriteFileFromStreamCommand, WriteFileFromStreamCommandResult> commandHandler, IPath path, IGuidProvider guidProvider, IDateTimeProvider dateTimeProvider, IOptions <IntegrationImportConfiguration> configuration) { _dataContext = dataContext; _fileInfoFactory = fileInfoFactory; _queryHandler = queryHandler; _commandHandler = commandHandler; _path = path; _guidProvider = guidProvider; _dateTimeProvider = dateTimeProvider; _configuration = configuration; }
public void CreateReaderChoosesCorrectReader() { // Arrange IFileSystem fs = Substitute.For <IFileSystem>(); IFileInfoFactory fileInfoFactory = Substitute.For <IFileInfoFactory>(); fileInfoFactory.FromFileName(Arg.Any <string>()) .ReturnsForAnyArgs(Substitute.For <FileInfoBase>()); fs.FileInfo.ReturnsForAnyArgs(fileInfoFactory); IDuplicateReader correctReader = Substitute.For <IDuplicateReader>(); correctReader.CanHandle(Arg.Any <FileInfoBase>()).Returns(true); IDuplicateReader incorrectReader1 = Substitute.For <IDuplicateReader>(); incorrectReader1.CanHandle(Arg.Any <FileInfoBase>()).Returns(false); IDuplicateReader incorrectReader2 = Substitute.For <IDuplicateReader>(); incorrectReader2.CanHandle(Arg.Any <FileInfoBase>()).Returns(false); DuplicateReaderFactory uut = new DuplicateReaderFactory( config: Substitute.For <IDuplicateHandlerConfiguration>(), fileSystem: fs, readers: new[] { incorrectReader1, correctReader, incorrectReader2 }); // Act IDuplicateReader selectedReader = uut.CreateReader(); // Assert Assert.Same(correctReader, selectedReader); }
public AzureCommonStorage( IAzureAppSettings commonAppSettings, IFileInfoFactory fileInfoFactory) { _commonAppSettings = commonAppSettings; _fileInfoFactory = fileInfoFactory; }
public AmazonCommonStorage( IAmazonS3 amazonS3, IFileInfoFactory fileInfoFactory) { _amazonS3 = amazonS3; _fileInfoFactory = fileInfoFactory; }
public JobsController( IJobService jobService, IAuthoriseJobEngine authoriseJobEngine, IUserService userService, IOneStepFileService oneStepFileService, IReportFileService reportFileService, IInputFileService inputFileService, IAppEnvironmentService appEnvironmentService, IPdfFileEngine pdfFileEngine, ILogger logger, IEnclosingJobService enclosingJobService, IJobStatusTypeService jobStatusTypeService, IFileInfoFactory fileInfoFactory) : base(logger, appEnvironmentService, userService) { this.jobService = jobService; this.authoriseJobEngine = authoriseJobEngine; this.userService = userService; this.oneStepFileService = oneStepFileService; this.reportFileService = reportFileService; this.inputFileService = inputFileService; this.pdfFileEngine = pdfFileEngine; this.enclosingJobService = enclosingJobService; this.jobStatusTypeService = jobStatusTypeService; _fileInfoFactory = fileInfoFactory; }
public MockFileSystem(IDictionary <string, MockFileData> files, string currentDirectory = "") { if (string.IsNullOrEmpty(currentDirectory)) { currentDirectory = IO.Path.GetTempPath(); } pathVerifier = new PathVerifier(this); this.files = new Dictionary <string, MockFileData>(StringComparer.OrdinalIgnoreCase); pathField = new MockPath(this); file = new MockFile(this); directory = new MockDirectory(this, file, currentDirectory); fileInfoFactory = new MockFileInfoFactory(this); directoryInfoFactory = new MockDirectoryInfoFactory(this); driveInfoFactory = new MockDriveInfoFactory(this); if (files != null) { foreach (var entry in files) { AddFile(entry.Key, entry.Value); } } }
public void CreateReaderThrowsIfNoReadersCanHandleFile() { // Arrange IFileSystem fs = Substitute.For <IFileSystem>(); IFileInfoFactory fileInfoFactory = Substitute.For <IFileInfoFactory>(); fileInfoFactory.FromFileName(Arg.Any <string>()) .ReturnsForAnyArgs(Substitute.For <FileInfoBase>()); fs.FileInfo.ReturnsForAnyArgs(fileInfoFactory); IDuplicateReader incorrectReader1 = Substitute.For <IDuplicateReader>(); incorrectReader1.CanHandle(Arg.Any <FileInfoBase>()).Returns(false); IDuplicateReader incorrectReader2 = Substitute.For <IDuplicateReader>(); incorrectReader2.CanHandle(Arg.Any <FileInfoBase>()).Returns(false); DuplicateReaderFactory uut = new DuplicateReaderFactory( config: Substitute.For <IDuplicateHandlerConfiguration>(), fileSystem: fs, readers: new[] { incorrectReader1, incorrectReader2 }); // Act & Assert Assert.Throws <ArgumentException>(() => uut.CreateReader()); }
public ExecutableResolver(IFileInfoFactory factory, IEnvironment environment) { _factory = factory; _environment = environment; // Replace this with a Lucene.net index _directories = SplitPath(); }
public VirtualFileSystem(IDictionary <string, VirtualFileData> files, string currentDirectory = "") { if (string.IsNullOrEmpty(currentDirectory)) { currentDirectory = System.IO.Path.GetTempPath(); } _pathVerifier = new PathVerifier(this); this._files = new Dictionary <string, VirtualFileData>(StringComparer.OrdinalIgnoreCase); _pathField = new VirtualPath(this); _file = new VirtualFile(this); _directory = new VirtualDirectory(this, _file, currentDirectory); _fileInfoFactory = new VirtualFileInfoFactory(this); _directoryInfoFactory = new VirtualDirectoryInfoFactory(this); _driveInfoFactory = new VirtualDriveInfoFactory(this); if (files != null) { foreach (var entry in files) { AddFile(entry.Key, entry.Value); } } }
/// <summary> /// Initializes a new instance of the <see cref="MoveFileCommandHandler"/> class /// </summary> /// <param name="directoryCreator">Injected directory creator</param> /// <param name="fileInfoFactory">Injected file info factory</param> public MoveFileCommandHandler( IDirectoryCreator directoryCreator, IFileInfoFactory fileInfoFactory) { _directoryCreator = directoryCreator; _fileInfoFactory = fileInfoFactory; }
public static IFileInfo GetFromFileInfo(this IFileInfoFactory fileInfoFactory, IFileInfo info) { if (fileInfoFactory is not ILinuxFileInfoFactory file) { throw new Exception("IFileInfoFactory is not the linux version"); } return(file.FromFileInfo(info)); }
public DirectoryInfoAdapter(IDirectoryInfoFactory directoryInfoFactory , IFileInfoFactory fileInfoFactory , DirectoryInfo directoryInfo) { this.DirectoryInfoFactory = directoryInfoFactory; this.FileInfoFactory = fileInfoFactory; this.DirectoryInfo = directoryInfo; }
public CollectItemsProvider( ICollectUrlExtractor collectUrlsExtractor, IFileInfoFactory fileInfoFactory, IIdentityServiceHttpRequestConfigurator identityServiceHttpRequestConfigurator) { _collectUrlExtractor = collectUrlsExtractor; _fileInfoFactory = fileInfoFactory; _identityServiceHttpRequestConfigurator = identityServiceHttpRequestConfigurator; }
public void Setup() { this.fileInfoFactory = new SystemFileInfoFactory(); this.directoryInfo = new SystemIoDirectoryInfo(); var di = new DirectoryInfo(BaseDirectory); this.oneStepFileRepository = new OneStepFileRepository(BaseDirectory, this.fileInfoFactory, this.directoryInfo); }
public MockFileSystem(IDictionary<string, MockFileData> files) { this.files = new Dictionary<string, MockFileData>( files, StringComparer.InvariantCultureIgnoreCase); file = new MockFile(this); directory = new MockDirectory(this, file); fileInfoFactory = new MockFileInfoFactory(this); }
public FileSystem( IFileInfoFactory fileInfoFactory, IDirectoryInfoFactory directoryInfoFactory) { FileInfo = fileInfoFactory; DirectoryInfo = directoryInfoFactory; File = new FileAdapter(); Directory = new DirectoryAdapter(); Path = new PathAdapter(); }
public void Setup() { this.fileInfoFactory = new SystemFileInfoFactory(); this.directoryInfo = new SystemIoDirectoryInfo(); this.reportFileRepository = new ReportFileRepository(BaseDirectory, this.fileInfoFactory, this.directoryInfo); this.reportInformationFile = "\\\\srv-dg-bravura4.dstoutput.co.uk\\Nexdox\\nmbbs02\\Process\\14315B-103811X-QQRD\\Output"; this.reportFilePath = "\\\\srv-dg-bravura4.dstoutput.co.uk\\Nexdox\\nmbbs02\\Process\\14315B-103811X-QQRD\\Output\\14315B-103811X-QQRD.log"; }
/// <summary> /// Initializes a new instance of the <see cref="CreateStreamFromPathQueryHandler"/> class /// </summary> /// <param name="path">Injected file path provider</param> /// <param name="fileInfoFactory">Injected file info factory</param> /// /// <param name="fileStreamFactory">Injected file stream factory</param> public CreateStreamFromPathQueryHandler( IPath path, IFileInfoFactory fileInfoFactory, IFileStreamFactory fileStreamFactory) { _path = path; _fileInfoFactory = fileInfoFactory; _fileStreamFactory = fileStreamFactory; }
/// <summary> /// Initializes a new instance of the <see cref="FileNameValidator"/> class. /// </summary> /// <param name="filePathProvider">Injected file path provider</param> /// <param name="path">Injected file info factory</param> public FileNameValidator( IPath filePathProvider, IFileInfoFactory path) { Argument.NotNull(filePathProvider, nameof(filePathProvider)); Argument.NotNull(path, nameof(path)); _path = filePathProvider; _fileInfoFactory = path; }
/// <summary> /// Initializes a new instance of the <see cref="StartUploadIntegrationImportDecorator"/> class /// </summary> /// <param name="handler">Injected command handler</param> /// <param name="client">Injected client</param> /// <param name="fileInfoFactory">Injected file info factory</param> public StartUploadIntegrationImportDecorator( IUploadIntegrationImportCommandHandler handler, IApiClient <StartIntegrationImportV1Request, StartIntegrationImportV1Response> client, IFileInfoFactory fileInfoFactory) : base(handler) { _handler = handler; _client = client; _fileInfoFactory = fileInfoFactory; }
public MockFileSystem(IDictionary <string, MockFileData> files) { this.files = new Dictionary <string, MockFileData>( files, StringComparer.InvariantCultureIgnoreCase); file = new MockFile(this); directory = new MockDirectory(this, file); fileInfoFactory = new MockFileInfoFactory(this); path = new MockPath(); directoryInfoFactory = new MockDirectoryInfoFactory(this); }
public MockFileSystem(IDictionary<string, MockFileData> files, string currentDirectory = @"C:\Foo\Bar") { this.files = new Dictionary<string, MockFileData>(StringComparer.OrdinalIgnoreCase); pathField = new MockPath(this); file = new MockFile(this); directory = new MockDirectory(this, file, FixPath(currentDirectory)); fileInfoFactory = new MockFileInfoFactory(this); directoryInfoFactory = new MockDirectoryInfoFactory(this); if (files == null) return; foreach (var entry in files) AddFile(entry.Key, entry.Value); }
public void Setup() { this.fileInfoFactory = new SystemFileInfoFactory(); this.directoryInfo = new SystemIoDirectoryInfo(); var di = new DirectoryInfo(BaseDirectory); this.pdfFileRepository = new PdfFileRepository(BaseDirectory, this.fileInfoFactory, this.directoryInfo); this.pdfFiles = new List <PdfFile>(); this.pdfFiles.Add(new PdfFile("fileName", "filePath")); this.pdfInformationFile = "\\\\srv-dg-bravura4.dstoutput.co.uk\\Nexdox\\nmbbs02\\Process\\141756-142156X-JMDD\\Output\\141756-142156X-JMDD-PDFFiles.web"; }
public void Setup() { _fileSystem = Substitute.For <IFileSystem>(); _directory = Substitute.For <DirectoryBase>(); _fileSystem.Directory.Returns(_directory); _file = Substitute.For <FileBase>(); _fileSystem.File.Returns(_file); _fileInfo = Substitute.For <FileInfoBase>(); _fileInfoFactory = Substitute.For <IFileInfoFactory>(); _fileInfoFactory.FromFileName(Arg.Any <string>()).Returns(_fileInfo); _fileSystem.FileInfo.Returns(_fileInfoFactory); _cache = new DirectoryImageCache(_folderPath, 2, _fileSystem); }
public ProjectRepository( IOptionsMonitor <ZealotConfiguration> zealotConfiguration , IDirectoryInfoFactory directoryInfoFactory , IFileInfoFactory fileInfoFactory , IJsonFileConverter <Project> projectJsonDump , IJsonFileConverter <List <Project> > projectsConfigListFileConverter , IAnnexFileConverter annexFileConverter) { _configuration = zealotConfiguration.CurrentValue; _directoryInfoFactory = directoryInfoFactory; _fileInfoFactory = fileInfoFactory; _projectFileConverter = projectJsonDump; _projectsConfigListFileConverter = projectsConfigListFileConverter; _annexFileConverter = annexFileConverter; }
public void Setup() { _fileInfoFactory = new SystemFileInfoFactory(); _directoryInfo = new SystemIoDirectoryInfo(); var di = new DirectoryInfo(BaseDirectory); if (di.Exists) { di.Delete(true); } di.Create(); _houseHoldingFileRepository = new HouseHoldingFileRepository(BaseDirectory, _fileInfoFactory, _directoryInfo); CreateFiles(BaseDirectory); }
public MockFileSystem(IDictionary<string, MockFileData> files, string currentDirectory = "") { if (String.IsNullOrEmpty(currentDirectory)) currentDirectory = IO.Path.GetTempPath(); this.files = new Dictionary<string, MockFileData>(StringComparer.OrdinalIgnoreCase); pathField = new MockPath(this); file = new MockFile(this); directory = new MockDirectory(this, file, currentDirectory); fileInfoFactory = new MockFileInfoFactory(this); directoryInfoFactory = new MockDirectoryInfoFactory(this); if (files == null) return; foreach (var entry in files) AddFileWithCreate(entry.Key, entry.Value); }
public SyncModel( ISyncSettingsRepository settingsRepository, IMessenger messenger, IFile file, IDirectory directory, IFileSystemWatcherFactory watcherFactory, IFileInfoFactory infoFactory) { _settingsRepository = settingsRepository; _file = file; _directory = directory; _watcherFactory = watcherFactory; _infoFactory = infoFactory; _messenger = messenger; _settings = _settingsRepository.Load(); }
public void SetUp() { _fileInfoFactory = new SystemFileInfoFactory(); _directoryInfo = new SystemIoDirectoryInfo(); var di = new DirectoryInfo(ExportFileDirectory); if (di.Exists) { di.Delete(true); } di.Create(); _fileData = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; this._exportFile = BuildMeA.ExportFile(Guid.NewGuid(), _fileData); this._exportFileRepository = new ExportFileRepository(BaseDirectory, _fileInfoFactory, _directoryInfo); }
public MockFileSystem(IDictionary <string, MockFileData> files, string currentDirectory = @"C:\Foo\Bar") { this.files = new Dictionary <string, MockFileData>(StringComparer.InvariantCultureIgnoreCase); pathField = new MockPath(this); file = new MockFile(this); directory = new MockDirectory(this, file, FixPath(currentDirectory)); fileInfoFactory = new MockFileInfoFactory(this); directoryInfoFactory = new MockDirectoryInfoFactory(this); if (files == null) { return; } foreach (var entry in files) { AddFile(entry.Key, entry.Value); } }
public override void SetUp() { base.SetUp(); _fileSystem = Substitute.For <IFileSystem>(); _directory = Substitute.For <DirectoryBase>(); _fileSystem.Directory.Returns(_directory); _file = Substitute.For <FileBase>(); _fileSystem.File.Returns(_file); _fileInfo = Substitute.For <FileInfoBase>(); _fileInfo.Exists.Returns(true); _fileInfoFactory = Substitute.For <IFileInfoFactory>(); _fileInfoFactory.FromFileName(Arg.Any <string>()).Returns(_fileInfo); _fileSystem.FileInfo.Returns(_fileInfoFactory); _folderPath = AppSettings.AvatarImageCachePath; _cache = new FileSystemAvatarCache(_inner, _fileSystem); }
/// <summary> /// Initializes a new instance of the <see cref="DataContext"/> class /// </summary> /// <param name="configuration">configuration</param> /// <param name="path">path</param> /// <param name="directoryCreator">directory creator</param> /// <param name="fileInfoFactory">file info factory</param> public DataContext( IOptions <DataContextConfiguration> configuration, IPath path, IDirectoryCreator directoryCreator, IFileInfoFactory fileInfoFactory) { Argument.NotNull(configuration, nameof(configuration)); Argument.NotNull(path, nameof(path)); Argument.NotNull(directoryCreator, nameof(directoryCreator)); Argument.NotNull(fileInfoFactory, nameof(fileInfoFactory)); _configuration = configuration; _path = path; _directoryCreator = directoryCreator; _fileInfoFactory = fileInfoFactory; }
public void Setup() { if (Type.GetType("Mono.Runtime") != null) { _folderPath = "/home/user/gitextensions/images"; } _fileSystem = Substitute.For <IFileSystem>(); _directory = Substitute.For <DirectoryBase>(); _fileSystem.Directory.Returns(_directory); _file = Substitute.For <FileBase>(); _fileSystem.File.Returns(_file); _fileInfo = Substitute.For <FileInfoBase>(); _fileInfoFactory = Substitute.For <IFileInfoFactory>(); _fileInfoFactory.FromFileName(Arg.Any <string>()).Returns(_fileInfo); _fileSystem.FileInfo.Returns(_fileInfoFactory); _cache = new DirectoryImageCache(_folderPath, 2, _fileSystem); }
public MockFileSystem(IDictionary<string, MockFileData> files) { file = new MockFile(this); directory = new MockDirectory(this, file); fileInfoFactory = new MockFileInfoFactory(this); path = new MockPath(); directoryInfoFactory = new MockDirectoryInfoFactory(this); //For each mock file add a file to the files dictionary //Also add a file entry for all directories leading up to this file this.files = new Dictionary<string, MockFileData>(StringComparer.InvariantCultureIgnoreCase); foreach (var entry in files) { var directoryPath = Path.GetDirectoryName(entry.Key); if (!directory.Exists(directoryPath)) directory.CreateDirectory(directoryPath); if (!file.Exists(entry.Key)) this.files.Add(entry.Key, entry.Value); } }
public MyMediaRepository(string path, IFileInfoFactory fileInfo, IDirectoryInfo directoryInfo) : base(path, fileInfo, directoryInfo) { }
public void Setup() { _fileInfoFactory = new SystemFileInfoFactory(); _directoryInfo = new SystemIoDirectoryInfo(); var di = new DirectoryInfo(PostsDirectory); if (di.Exists) { di.Delete(true); } di.Create(); _postRepository = new PostRepository(BaseDirectory, _fileInfoFactory, _directoryInfo); CreateFiles(PostsDirectory); }