public void Query_Recursive_WhenCalled(string search, int folders, int files, bool truncated)
        {
            const int maxFolderSetting = 3;

            // Setup
            var folderSettings = new FolderSettings()
            {
                MaxFileResults   = maxFolderSetting,
                MaxFolderResults = maxFolderSetting,
            };

            var queryInternalDirectory = new QueryInternalDirectory(folderSettings, _queryFileSystemInfoMock, _fileSystem.Directory);

            // Act
            var isDriveOrSharedFolder = queryInternalDirectory.Query(search)
                                        .ToLookup(r => r.GetType());

            // Assert
            Assert.AreEqual(files, isDriveOrSharedFolder[typeof(FileItemResult)].Count(), "File count doesn't match");
            Assert.AreEqual(folders, isDriveOrSharedFolder[typeof(FolderItemResult)].Count(), "folder count doesn't match");

            // Always check if there is less than max folders
            Assert.LessOrEqual(isDriveOrSharedFolder[typeof(FileItemResult)].Count(), maxFolderSetting, "Files are not limited");
            Assert.LessOrEqual(isDriveOrSharedFolder[typeof(FolderItemResult)].Count(), maxFolderSetting, "Folders are not limited");

            // Checks if CreateOpenCurrentFolder is displayed
            Assert.AreEqual(Math.Min(folders + files, 1), isDriveOrSharedFolder[typeof(CreateOpenCurrentFolderResult)].Count(), "CreateOpenCurrentFolder displaying is incorrect");

            Assert.AreEqual(truncated, isDriveOrSharedFolder[typeof(TruncatedItemResult)].Count() == 1, "CreateOpenCurrentFolder displaying is incorrect");
        }
        public void Query_ThrowsException_WhenCalledNull()
        {
            // Setup
            var queryInternalDirectory = new QueryInternalDirectory(new FolderSettings(), _queryFileSystemInfoMock, _fileSystem.Directory);

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => queryInternalDirectory.Query(null).ToArray());
        }
Beispiel #3
0
 private static void UpdateIconPath(Theme theme)
 {
     QueryInternalDirectory.SetWarningIcon(theme);
 }