public void CreateFileBrowserOperationTest() { FileBrowserOperation operation = new FileBrowserOperation(null, "", null); Assert.True(operation.FileTree != null); // It should set "*" filter as default Assert.True(operation.FileFilters.Length == 1); }
public void ExpandNodeShouldThrowExceptionForInvalidPath() { FileBrowserOperation operation = new FileBrowserOperation(null, "", null); Exception exception = null; try { operation.PathSeparator = '/'; operation.ExpandSelectedNode("testdrive/filebrowser/test"); } catch (FileBrowserException ex) { exception = ex; } Assert.NotNull(exception); Assert.Null(operation.FileTree.SelectedNode); }
public void FilterFilesTest() { FileBrowserOperation operation = new FileBrowserOperation(null, "", null); string[] supportedFilePaths = new string[] { "te\\s/t1.txt", "te!s.t2.bak" }; string[] unsupportedFilePaths = new string[] { "te.s*/t3.jpg", "t_est4.trn" }; string[] filters = new string[] { "*.txt", "*.bak" }; foreach (string path in supportedFilePaths) { Assert.True(operation.FilterFile(path, filters)); } foreach (string path in unsupportedFilePaths) { Assert.False(operation.FilterFile(path, filters)); } }