public void FilePattern_Local_WildChar_1()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder1", "testfile2"));
            if (CrossPlatformHelpers.IsWindows)
            {
                nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "TESTFILE345"));
            }

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "testfile234"));

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "testfile1"));

            if (CrossPlatformHelpers.IsWindows)
            {
                nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "TestFile2"));
            }

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile1"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile2"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(true, expectedResult, "testfile*");
        }
        public void FilePattern_CloudBlob_NoPattern_1()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder1", "testfile2"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder1", "4testfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "subfolder4", "test5"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "testfile234"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "TESTFILE345"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "testYfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "f_arbitrary.exe"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "测试x文件"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "testfile1"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "TestFile2"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "测试文件2"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder2", "folder_file"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder2", "测试文件三"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder2", "测试四文件"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "TeSTfIle"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile1"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile2"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testXfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testXXfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "测试文件"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "..a123"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(true, expectedResult);
        }
        public void FilePattern_CloudBlob_NoPattern_2()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(false, expectedResult);
        }
        public void FilePattern_CloudFile_Unicode_2()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder2", "测试四文件"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(false, expectedResult, "folder2/测试四文件");
        }
        public void FilePattern_CloudBlob_Prefix_4()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "TestFile2"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(true, expectedResult, "folder1/TestFile");
        }
        public void FilePattern_Local_DoubleDotValid_3()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "..a123"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(false, expectedResult, "..*");
        }
        public void FilePattern_CloudFile_FilePath_2()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "TestFile2"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(false, expectedResult, FormalizeSearchPattern("folder1\\TestFile2"));
        }
        public void FilePattern_Local_FilePath_3()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "f_arbitrary.exe"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(false, expectedResult, FormalizeSearchPattern("folder1\\subfolder2\\f_arbitrary.exe"));
        }
        public void FilePattern_Local_WildChar_4()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testXfile"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(false, expectedResult, "test?file");
        }
        public void FilePattern_Local_FilePath_1()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder1", "4testfile"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(true, expectedResult, "folder1\\subfolder1\\4testfile");
        }
        public void FilePattern_CloudBlob_Prefix_3()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "subfolder4", "test5"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "TESTFILE345"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "testYfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "f_arbitrary.exe"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "folder1", "subfolder2", "测试x文件"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(true, expectedResult, "folder1/subfolder2");
        }
        public void FilePattern_Local_NoPattern_2()
        {
            HashSet <FileNode> nodesToKeep    = new HashSet <FileNode>();
            DMLibDataInfo      expectedResult = SourceDataInfo.Clone();

            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile1"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testfile2"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testXfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "testXXfile"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "测试文件"));
            nodesToKeep.Add(DMLibDataHelper.GetFileNode(expectedResult.RootNode, "..a123"));
            DMLibDataHelper.RemoveAllFileNodesExcept(expectedResult.RootNode, nodesToKeep);

            this.TestSearchPattern(false, expectedResult);
        }