public FileController(BaseSimpleControllerServices services, FileControllerConfig config, FileViewService service, ILanguageService languageService) : base(services) { this.config = config; this.service = service; this.docService = languageService; }
public void ViewFiles_NoEventsWithFilter_ReturnsCollectionOfFilesAndDirectories() { // Arrange var service = new FileViewService(_logger.Object, (arr) => arr.Where(item => item.Contains("1")).ToArray(), _systemEntityService.Object); // Act var collection = service.ViewFiles(_path); //// Assert Assert.IsTrue(collection.Count(item => _files.Any(file => item.Contains(file))) == 3); Assert.IsTrue(collection.Count(item => _directories.Any(directory => item.Contains(directory))) == 1); }
public void ViewFiles_NoEventsNoFilters_ReturnsCollectionOfFilesAndDirectoriesWithNumberInName() { // Arrange var service = new FileViewService(_logger.Object, null, _systemEntityService.Object); // Act var collection = service.ViewFiles(_path); //// Assert Assert.IsTrue(collection.Count(item => _files.Any(file => item.Contains(file))) == 6); Assert.IsTrue(collection.Count(item => _directories.Any(directory => item.Contains(directory))) == 2); }
public void ViewFiles_WithDirectoryFindedEventWithFilter_ReturnsCollectionDirectoriesWithoutFiles() { // Arrange var service = new FileViewService(_logger.Object, (arr) => arr.Where(item => item.Contains("1")).ToArray(), _systemEntityService.Object); service.DirectoryFinded += (ref FileViewerEventArgs args) => { args.StopSearching = true; }; // Act var collection = service.ViewFiles(_path); //// Assert Assert.IsTrue(collection.Count(item => _files.Any(file => item.Contains(file))) == 0); Assert.IsTrue(collection.Count(item => _directories.Any(directory => item.Contains(directory))) == 2); }