[PlatformSpecific(TestPlatforms.Windows)]  // Windows-invalid search patterns throw
        public void WindowsSearchPatternInvalid()
        {
            Assert.Throws <ArgumentException>(() => GetEntries(TestDirectory, "\0"));
            Assert.Throws <ArgumentException>(() => GetEntries(TestDirectory, "|"));

            Assert.All(Path.GetInvalidFileNameChars(), invalidChar =>
            {
                switch (invalidChar)
                {
                case '\\':
                case '/':
                    Assert.Throws <DirectoryNotFoundException>(() => GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidChar.ToString())));
                    break;

                //We don't throw in V1 too
                case ':':
                    //History:
                    // 1) we assumed that this will work in all non-9x machine
                    // 2) Then only in XP
                    // 3) NTFS?
                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
                        FileSystemDebugInfo.IsCurrentDriveNTFS())     // testing NTFS
                    {
                        Assert.Throws <IOException>(() => GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidChar.ToString())));
                    }
                    else
                    {
                        GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidChar.ToString()));
                    }
                    break;

                // Wildcard chars
                case '*':
                case '?':
                case '<':
                case '>':
                case '\"':
                    GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidChar.ToString()));
                    break;

                default:
                    Assert.Throws <ArgumentException>(() => GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidChar.ToString())));
                    break;
                }
            });
        }
示例#2
0
        public void WindowsSearchPatternInvalid()
        {
            Assert.Throws <ArgumentException>(() => GetEntries(TestDirectory, "\0"));
            Assert.Throws <ArgumentException>(() => GetEntries(TestDirectory, ">"));

            Char[] invalidFileNames = Path.GetInvalidFileNameChars();
            for (int i = 0; i < invalidFileNames.Length; i++)
            {
                switch (invalidFileNames[i])
                {
                case '\\':
                case '/':
                    Assert.Throws <DirectoryNotFoundException>(() => GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidFileNames[i].ToString())));
                    break;

                //We dont throw in V1 too
                case ':':
                    //History:
                    // 1) we assumed that this will work in all non-9x machine
                    // 2) Then only in XP
                    // 3) NTFS?
                    if (Interop.IsWindows && FileSystemDebugInfo.IsCurrentDriveNTFS())     // testing NTFS
                    {
                        Assert.Throws <IOException>(() => GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidFileNames[i].ToString())));
                    }
                    else
                    {
                        GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidFileNames[i].ToString()));
                    }

                    break;

                case '*':
                case '?':
                    GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidFileNames[i].ToString()));
                    break;

                default:
                    Assert.Throws <ArgumentException>(() => GetEntries(Directory.GetCurrentDirectory(), string.Format("te{0}st", invalidFileNames[i].ToString())));
                    break;
                }
            }
        }
 public void InvalidPath()
 {
     foreach (char invalid in Path.GetInvalidFileNameChars())
     {
         if (invalid == '/' || invalid == '\\')
         {
             Assert.Throws <DirectoryNotFoundException>(() => GetEntries(Path.Combine(TestDirectory, string.Format("te{0}st", invalid.ToString()))));
         }
         else if (invalid == ':')
         {
             if (FileSystemDebugInfo.IsCurrentDriveNTFS())
             {
                 Assert.Throws <NotSupportedException>(() => GetEntries(Path.Combine(TestDirectory, string.Format("te{0}st", invalid.ToString()))));
             }
         }
         else
         {
             Assert.Throws <ArgumentException>(() => GetEntries(Path.Combine(TestDirectory, string.Format("te{0}st", invalid.ToString()))));
         }
     }
 }
示例#4
0
    [PlatformSpecific(TestPlatforms.Windows)] // testing mounting volumes and reparse points
    public static void runTest()
    {
        try
        {
            Stopwatch watch;

            const string MountPrefixName = "LaksMount";

            string        mountedDirName;
            string        dirNameWithoutRoot;
            string        dirNameReferedFromMountedDrive;
            string        dirName;
            string[]      expectedFiles;
            string[]      files;
            string[]      expectedDirs;
            string[]      dirs;
            List <string> list;

            watch = new Stopwatch();
            watch.Start();
            try
            {
                //Scenario 1: Vanilla - Different drive is mounted on the current drive
                Console.WriteLine("Scenario 1 - Vanilla: Different drive is mounted on the current drive: {0}", watch.Elapsed);

                string otherDriveInMachine = IOServices.GetNtfsDriveOtherThanCurrent();
                if (FileSystemDebugInfo.IsCurrentDriveNTFS() && otherDriveInMachine != null)
                {
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(Path.DirectorySeparatorChar.ToString(), MountPrefixName));
                    try
                    {
                        Console.WriteLine("Creating directory " + mountedDirName);
                        Directory.CreateDirectory(mountedDirName);
                        MountHelper.Mount(otherDriveInMachine.Substring(0, 2), mountedDirName);

                        dirName = ManageFileSystem.GetNonExistingDir(otherDriveInMachine, ManageFileSystem.DirPrefixName);
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                        {
                            dirNameWithoutRoot             = dirName.Substring(3);
                            dirNameReferedFromMountedDrive = Path.Combine(mountedDirName, dirNameWithoutRoot);

                            //Files
                            expectedFiles = fileManager.GetAllFiles();
                            list          = new List <string>();
                            //We will only test the filenames since they are unique
                            foreach (string file in expectedFiles)
                            {
                                list.Add(Path.GetFileName(file));
                            }
                            files = Directory.GetFiles(dirNameReferedFromMountedDrive, "*.*", SearchOption.AllDirectories);
                            Eval(files.Length == list.Count, "Err_3947g! wrong count");
                            for (int i = 0; i < expectedFiles.Length; i++)
                            {
                                if (Eval(list.Contains(Path.GetFileName(files[i])), "Err_582bmw! No file found: {0}", files[i]))
                                {
                                    list.Remove(Path.GetFileName(files[i]));
                                }
                            }
                            if (!Eval(list.Count == 0, "Err_891vut! wrong count: {0}", list.Count))
                            {
                                Console.WriteLine();
                                foreach (string fileName in list)
                                {
                                    Console.WriteLine(fileName);
                                }
                            }

                            //Directories
                            expectedDirs = fileManager.GetAllDirectories();
                            list         = new List <string>();
                            foreach (string dir in expectedDirs)
                            {
                                list.Add(dir.Substring(dirName.Length));
                            }
                            dirs = Directory.GetDirectories(dirNameReferedFromMountedDrive, "*.*", SearchOption.AllDirectories);
                            Eval(dirs.Length == list.Count, "Err_813weq! wrong count");
                            for (int i = 0; i < dirs.Length; i++)
                            {
                                string exDir = dirs[i].Substring(dirNameReferedFromMountedDrive.Length);
                                if (Eval(list.Contains(exDir), "Err_287kkm! No file found: {0}", exDir))
                                {
                                    list.Remove(exDir);
                                }
                            }
                            if (!Eval(list.Count == 0, "Err_921mhs! wrong count: {0}", list.Count))
                            {
                                Console.WriteLine();
                                foreach (string value in list)
                                {
                                    Console.WriteLine(value);
                                }
                            }
                        }
                    }
                    finally
                    {
                        MountHelper.Unmount(mountedDirName);
                        DeleteDir(mountedDirName, true);
                    }
                }
                else
                {
                    Console.WriteLine("Skipping since drive is not NTFS and there is no other drive on the machine");
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_768lme! Exception caught in scenario: {0}", ex);
            }

            //Scenario 2: Current drive is mounted on a different drive
            Console.WriteLine(Environment.NewLine + "Scenario 2 - Current drive is mounted on a different drive: {0}", watch.Elapsed);
            try
            {
                string otherDriveInMachine = IOServices.GetNtfsDriveOtherThanCurrent();
                if (otherDriveInMachine != null)
                {
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(otherDriveInMachine.Substring(0, 3), MountPrefixName));
                    try
                    {
                        Directory.CreateDirectory(mountedDirName);

                        MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);

                        dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                        {
                            dirNameWithoutRoot             = dirName.Substring(3);
                            dirNameReferedFromMountedDrive = Path.Combine(mountedDirName, dirNameWithoutRoot);
                            //Files
                            expectedFiles = fileManager.GetAllFiles();
                            list          = new List <string>();
                            //We will only test the filenames since they are unique
                            foreach (string file in expectedFiles)
                            {
                                list.Add(Path.GetFileName(file));
                            }
                            files = Directory.GetFiles(dirNameReferedFromMountedDrive, "*.*", SearchOption.AllDirectories);
                            Eval(files.Length == list.Count, "Err_689myg! wrong count");
                            for (int i = 0; i < expectedFiles.Length; i++)
                            {
                                if (Eval(list.Contains(Path.GetFileName(files[i])), "Err_894vhm! No file found: {0}", files[i]))
                                {
                                    list.Remove(Path.GetFileName(files[i]));
                                }
                            }
                            if (!Eval(list.Count == 0, "Err_952qkj! wrong count: {0}", list.Count))
                            {
                                Console.WriteLine();
                                foreach (string fileName in list)
                                {
                                    Console.WriteLine(fileName);
                                }
                            }

                            //Directories
                            expectedDirs = fileManager.GetAllDirectories();
                            list         = new List <string>();
                            foreach (string dir in expectedDirs)
                            {
                                list.Add(dir.Substring(dirName.Length));
                            }
                            dirs = Directory.GetDirectories(dirNameReferedFromMountedDrive, "*.*", SearchOption.AllDirectories);
                            Eval(dirs.Length == list.Count, "Err_154vrz! wrong count");
                            for (int i = 0; i < dirs.Length; i++)
                            {
                                string exDir = dirs[i].Substring(dirNameReferedFromMountedDrive.Length);
                                if (Eval(list.Contains(exDir), "Err_301sao! No file found: {0}", exDir))
                                {
                                    list.Remove(exDir);
                                }
                            }
                            if (!Eval(list.Count == 0, "Err_630gjj! wrong count: {0}", list.Count))
                            {
                                Console.WriteLine();
                                foreach (string value in list)
                                {
                                    Console.WriteLine(value);
                                }
                            }
                        }
                    }
                    finally
                    {
                        MountHelper.Unmount(mountedDirName);
                        DeleteDir(mountedDirName, true);
                    }
                }
                else
                {
                    Console.WriteLine("Skipping since drive is not NTFS and there is no other drive on the machine");
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_231vwf! Exception caught in scenario: {0}", ex);
            }

            //scenario 3.1: Current drive is mounted on current drive
            Console.WriteLine(Environment.NewLine + "Scenario 3.1 - Current drive is mounted on current drive: {0}", watch.Elapsed);
            try
            {
                if (FileSystemDebugInfo.IsCurrentDriveNTFS())
                {
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(Path.DirectorySeparatorChar.ToString(), MountPrefixName));
                    try
                    {
                        Directory.CreateDirectory(mountedDirName);
                        MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);

                        dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                        {
                            dirNameWithoutRoot             = dirName.Substring(3);
                            dirNameReferedFromMountedDrive = Path.Combine(mountedDirName, dirNameWithoutRoot);
                            //Files
                            expectedFiles = fileManager.GetAllFiles();
                            list          = new List <string>();
                            //We will only test the filenames since they are unique
                            foreach (string file in expectedFiles)
                            {
                                list.Add(Path.GetFileName(file));
                            }
                            files = Directory.GetFiles(dirNameReferedFromMountedDrive, "*.*", SearchOption.AllDirectories);
                            Eval(files.Length == list.Count, "Err_213fuo! wrong count");
                            for (int i = 0; i < expectedFiles.Length; i++)
                            {
                                if (Eval(list.Contains(Path.GetFileName(files[i])), "Err_499oxz! No file found: {0}", files[i]))
                                {
                                    list.Remove(Path.GetFileName(files[i]));
                                }
                            }
                            if (!Eval(list.Count == 0, "Err_301gtz! wrong count: {0}", list.Count))
                            {
                                Console.WriteLine();
                                foreach (string fileName in list)
                                {
                                    Console.WriteLine(fileName);
                                }
                            }

                            //Directories
                            expectedDirs = fileManager.GetAllDirectories();
                            list         = new List <string>();
                            foreach (string dir in expectedDirs)
                            {
                                list.Add(dir.Substring(dirName.Length));
                            }
                            dirs = Directory.GetDirectories(dirNameReferedFromMountedDrive, "*.*", SearchOption.AllDirectories);
                            Eval(dirs.Length == list.Count, "Err_771dxv! wrong count");
                            for (int i = 0; i < dirs.Length; i++)
                            {
                                string exDir = dirs[i].Substring(dirNameReferedFromMountedDrive.Length);
                                if (Eval(list.Contains(exDir), "Err_315jey! No file found: {0}", exDir))
                                {
                                    list.Remove(exDir);
                                }
                            }
                            if (!Eval(list.Count == 0, "Err_424opm! wrong count: {0}", list.Count))
                            {
                                Console.WriteLine();
                                foreach (string value in list)
                                {
                                    Console.WriteLine(value);
                                }
                            }
                        }
                    }
                    finally
                    {
                        MountHelper.Unmount(mountedDirName);
                        DeleteDir(mountedDirName, true);
                    }
                }
                else
                {
                    Console.WriteLine("Drive is not NTFS. Skipping scenario");
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_493ojg! Exception caught in scenario: {0}", ex);
            }

            //scenario 3.2: Current drive is mounted on current directory
            Console.WriteLine(Environment.NewLine + "Scenario 3.2 - Current drive is mounted on current directory: {0}", watch.Elapsed);
            try
            {
                if (FileSystemDebugInfo.IsCurrentDriveNTFS())
                {
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), MountPrefixName));
                    try
                    {
                        Directory.CreateDirectory(mountedDirName);
                        MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);

                        dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                        {
                            dirNameWithoutRoot             = dirName.Substring(3);
                            dirNameReferedFromMountedDrive = Path.Combine(mountedDirName, dirNameWithoutRoot);
                            //Files
                            expectedFiles = fileManager.GetAllFiles();
                            list          = new List <string>();
                            //We will only test the filenames since they are unique
                            foreach (string file in expectedFiles)
                            {
                                list.Add(Path.GetFileName(file));
                            }
                            files = Directory.GetFiles(dirNameReferedFromMountedDrive, "*.*", SearchOption.AllDirectories);
                            Eval(files.Length == list.Count, "Err_253yit! wrong count");
                            for (int i = 0; i < expectedFiles.Length; i++)
                            {
                                if (Eval(list.Contains(Path.GetFileName(files[i])), "Err_798mjs! No file found: {0}", files[i]))
                                {
                                    list.Remove(Path.GetFileName(files[i]));
                                }
                            }
                            if (!Eval(list.Count == 0, "Err_141lgl! wrong count: {0}", list.Count))
                            {
                                Console.WriteLine();
                                foreach (string fileName in list)
                                {
                                    Console.WriteLine(fileName);
                                }
                            }

                            //Directories
                            expectedDirs = fileManager.GetAllDirectories();
                            list         = new List <string>();
                            foreach (string dir in expectedDirs)
                            {
                                list.Add(dir.Substring(dirName.Length));
                            }
                            dirs = Directory.GetDirectories(dirNameReferedFromMountedDrive, "*.*", SearchOption.AllDirectories);
                            Eval(dirs.Length == list.Count, "Err_512oxq! wrong count");
                            for (int i = 0; i < dirs.Length; i++)
                            {
                                string exDir = dirs[i].Substring(dirNameReferedFromMountedDrive.Length);
                                if (Eval(list.Contains(exDir), "Err_907zbr! No file found: {0}", exDir))
                                {
                                    list.Remove(exDir);
                                }
                            }
                            if (!Eval(list.Count == 0, "Err_574raf! wrong count: {0}", list.Count))
                            {
                                Console.WriteLine();
                                foreach (string value in list)
                                {
                                    Console.WriteLine(value);
                                }
                            }
                        }
                    }
                    finally
                    {
                        MountHelper.Unmount(mountedDirName);
                        DeleteDir(mountedDirName, true);
                    }
                }
                else
                {
                    Console.WriteLine("Drive is not NTFS. Skipping scenario");
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_432qcp! Exception caught in scenario: {0}", ex);
            }

            Console.WriteLine("Completed {0}", watch.Elapsed);
        }
        catch (Exception ex)
        {
            s_pass = false;
            Console.WriteLine("Err_234rsgf! Uncaught exception in RunTest: {0}", ex);
        }

        Assert.True(s_pass);
    }
示例#5
0
    public static void runTest()
    {
        try
        {
            String        dirName;
            String[]      expectedFiles;
            String[]      files;
            List <String> list;
            // part I - SearchOption.TopDirectoryOnly
            //Scenario 1:Vanilla - Create a directory, add a few files and call with searchPattern *.* and verify
            //that all files are returned.
            try
            {
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 1, 10))
                {
                    expectedFiles = fileManager.GetFiles(dirName, 0);
                    list          = new List <String>(expectedFiles);
                    files         = Directory.GetFiles(dirName, "*.*", SearchOption.TopDirectoryOnly);
                    Eval(files.Length, list.Count, "Err_3947g! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_582bmw! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_891vut! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_349t7g! Exception caught in scenario: {0}", ex);
            }

            //Scenario 2: Add some directories to the vanilla scenario and ensure that these are not returned
            //Scenario 3: Ensure that the path contains subdirectories and call this API and ensure that only the top directory files are returned
            try
            {
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                {
                    expectedFiles = fileManager.GetFiles(dirName, 0);
                    list          = new List <String>(expectedFiles);
                    files         = Directory.GetFiles(dirName, "*.*", SearchOption.TopDirectoryOnly);
                    Eval(files.Length, list.Count, "Err_763pjg! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_512kvk! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_839rbd! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_997pvx! Exception caught in scenario: {0}", ex);
            }

            // Path is not in the current directory (same drive)
            //Scenario 4: Ensure that the path contains subdirectories and call this API and ensure that only the top directory files are returned

            /* Scenario disabled when porting because it modifies the filesystem outside of the test's working directory
             * try
             * {
             *  dirName = ManageFileSystem.GetNonExistingDir(Path.DirectorySeparatorChar.ToString(), ManageFileSystem.DirPrefixName);
             *  using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
             *  {
             *      expectedFiles = fileManager.GetFiles(dirName, 0);
             *      list = new List<String>(expectedFiles);
             *      files = Directory.GetFiles(dirName, "*.*", SearchOption.TopDirectoryOnly);
             *      Eval(files.Length, list.Count, "Err_386gef! wrong file count.");
             *      for (int i = 0; i < files.Length; i++)
             *      {
             *          //This will return as \<dirName>\<fileName> whereas our utility will return as <drive>:\<dirName>\<fileName>
             *          String fileFullName = Path.GetFullPath(files[i]);
             *          if (Eval(list.Contains(fileFullName), "Err_932izm! unexpected file found: {0}", fileFullName))
             *              list.Remove(fileFullName);
             *      }
             *      if (!Eval(list.Count == 0, "Err_915sae! {0} expected files not found.", list.Count))
             *      {
             *          foreach (String fileName in list)
             *              Console.WriteLine(fileName);
             *      }
             *  }
             *  //only 1 level
             *  dirName = ManageFileSystem.GetNonExistingDir(Path.DirectorySeparatorChar.ToString(), ManageFileSystem.DirPrefixName);
             *  dirName = Path.GetFullPath(dirName);
             *  using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 1, 10))
             *  {
             *      expectedFiles = fileManager.GetFiles(dirName, 0);
             *      list = new List<String>(expectedFiles);
             *      files = Directory.GetFiles(dirName, "*.*", SearchOption.TopDirectoryOnly);
             *      Eval(files.Length, list.Count, "Err_792ifb! wrong file count.");
             *      for (int i = 0; i < files.Length; i++)
             *      {
             *          if (Eval(list.Contains(files[i]), "Err_281tff! unexpected file found: {0}", files[i]))
             *              list.Remove(files[i]);
             *      }
             *      if (!Eval(list.Count == 0, "Err_792qdn! {0} expected files not found.", list.Count))
             *      {
             *          foreach (String fileName in list)
             *              Console.WriteLine(fileName);
             *      }
             *  }
             * }
             * catch (Exception ex)
             * {
             *  s_pass = false;
             *  Console.WriteLine("Err_992hic! Exception caught in scenario: {0}", ex);
             * }
             */

            //Scenario 5: searchPattern variations - valid search characters, file match exactly the searchPattern, searchPattern is a subset of existing files, superset, no match,
            try
            {
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                String searchPattern;
                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                {
                    expectedFiles = fileManager.GetFiles(dirName, 0);
                    //?
                    int maxLen = 0;
                    foreach (String file in expectedFiles)
                    {
                        String realFile = Path.GetFileNameWithoutExtension(file);
                        if (realFile.Length > maxLen)
                        {
                            maxLen = realFile.Length;
                        }
                    }
                    searchPattern = String.Format("{0}.???", new String('?', maxLen));
                    list          = new List <String>(expectedFiles);
                    files         = Directory.GetFiles(dirName, searchPattern, SearchOption.TopDirectoryOnly);
                    Eval(files.Length, list.Count, "Err_488sjb! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_750dop! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_629dvi! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }

                    //file match exactly
                    searchPattern = Path.GetFileName(expectedFiles[0]);
                    list          = new List <String>(new String[] { expectedFiles[0] });
                    files         = Directory.GetFiles(dirName, searchPattern, SearchOption.TopDirectoryOnly);
                    Eval(files.Length, list.Count, "Err_841dnz! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_796xxd! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_552puh! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }

                    //subset
                    String        tempSearchPattern = Path.GetFileName(expectedFiles[0]).Substring(2);
                    List <String> newFiles          = new List <String>();
                    foreach (String file in expectedFiles)
                    {
                        String realFile = Path.GetFileName(file);
                        if (realFile.Substring(2).Equals(tempSearchPattern))
                        {
                            newFiles.Add(file);
                        }
                    }
                    searchPattern = String.Format("??{0}", tempSearchPattern);

                    list  = newFiles;
                    files = Directory.GetFiles(dirName, searchPattern, SearchOption.TopDirectoryOnly);
                    Eval(files.Length, list.Count, "Err_847vxz! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_736kfh! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_576atr! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }

                    //there shouldn't be any with just the suffix
                    searchPattern = tempSearchPattern;
                    list          = new List <String>();
                    files         = Directory.GetFiles(dirName, searchPattern, SearchOption.TopDirectoryOnly);
                    Eval(files.Length, list.Count, "Err_624jmn! wrong file count.");

                    //superset
                    searchPattern = String.Format("blah{0}", Path.GetFileName(expectedFiles[0]));
                    newFiles      = new List <String>();
                    foreach (String file in expectedFiles)
                    {
                        String realFile = Path.GetFileName(file);
                        if (realFile.Equals(searchPattern))
                        {
                            newFiles.Add(file);
                        }
                    }

                    list  = newFiles;
                    files = Directory.GetFiles(dirName, searchPattern, SearchOption.TopDirectoryOnly);
                    Eval(files.Length, list.Count, "Err_026zqz! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_832yyg! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_605dke! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_728ono! Exception caught in scenario: {0}", ex);
            }

            //Scenario 6: Different local drives, Network drives (UNC and drive letters)

            /* Scenario disabled when porting because it modifies the filesystem outside of the test's working directory
             * try
             * {
             *  string otherDriveInMachine = IOServices.GetNonNtfsDriveOtherThanCurrent();
             *  if (otherDriveInMachine != null)
             *  {
             *      dirName = ManageFileSystem.GetNonExistingDir(otherDriveInMachine, ManageFileSystem.DirPrefixName);
             *      using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
             *      {
             *          Console.WriteLine("otherDriveInMachine: {0}", dirName);
             *          expectedFiles = fileManager.GetFiles(dirName, 0);
             *          list = new List<String>(expectedFiles);
             *          files = Directory.GetFiles(dirName, "*.*", SearchOption.TopDirectoryOnly);
             *          Eval(files.Length, list.Count, "Err_337kkf! wrong file count.");
             *          for (int i = 0; i < files.Length; i++)
             *          {
             *              if (Eval(list.Contains(files[i]), "Err_448nzn! unexpected file found: {0}", files[i]))
             *                  list.Remove(files[i]);
             *          }
             *          if (!Eval(list.Count == 0, "Err_849fvp! {0} expected files not found.", list.Count))
             *          {
             *              foreach (String fileName in list)
             *                  Console.WriteLine(fileName);
             *          }
             *      }
             *  }
             *
             *  // network path scenario moved to RemoteIOTests.cs
             * }
             * catch (Exception ex)
             * {
             *  s_pass = false;
             *  Console.WriteLine("Err_768lme! Exception caught in scenario: {0}", ex);
             * }
             */


            //Scenario 7: Arguments validation:
            // - nulls for the first 2,
            // - outside range for the enum value.
            // - Path contains empty, space and invalid filename, long, readonly invalid characters. The same for searchPattern parm as well
            try
            {
                String[] invalidValuesForPath   = Interop.IsWindows ? new[] { "", " ", ">" } : new[] { "", "\0" };
                String[] invalidValuesForSearch = { "..", @".." + Path.DirectorySeparatorChar };
                CheckException <ArgumentNullException>(delegate { files = Directory.GetFiles(null, "*.*", SearchOption.TopDirectoryOnly); }, "Err_347g! worng exception thrown");
                CheckException <ArgumentNullException>(delegate { files = Directory.GetFiles(Directory.GetCurrentDirectory(), null, SearchOption.TopDirectoryOnly); }, "Err_326pgt! worng exception thrown");
                CheckException <ArgumentOutOfRangeException>(delegate { files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.*", (SearchOption)100); }, "Err_589kvu! worng exception thrown - see bug #386545");
                CheckException <ArgumentOutOfRangeException>(delegate { files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.*", (SearchOption)(-1)); }, "Err_359vcj! worng exception thrown - see bug #386545");
                for (int i = 0; i < invalidValuesForPath.Length; i++)
                {
                    CheckException <ArgumentException>(delegate { files = Directory.GetFiles(invalidValuesForPath[i], "*.*", SearchOption.TopDirectoryOnly); }, String.Format("Err_347sd_{0}! worng exception thrown: {1}", i, invalidValuesForPath[i]));
                }
                for (int i = 0; i < invalidValuesForSearch.Length; i++)
                {
                    CheckException <ArgumentException>(delegate { files = Directory.GetFiles(Directory.GetCurrentDirectory(), invalidValuesForSearch[i], SearchOption.TopDirectoryOnly); }, String.Format("Err_074ts! worng exception thrown: {1}", i, invalidValuesForSearch[i]));
                }
                Char[] invalidPaths = Path.GetInvalidPathChars();
                for (int i = 0; i < invalidPaths.Length; i++)
                {
                    CheckException <ArgumentException>(delegate { files = Directory.GetFiles(invalidPaths[i].ToString(), "*.*", SearchOption.TopDirectoryOnly); }, String.Format("Err_538wyc! worng exception thrown: {1}", i, invalidPaths[i]));
                }
                Char[] invalidFileNames = Interop.IsWindows ? Path.GetInvalidFileNameChars() : new[] { '\0' };
                for (int i = 0; i < invalidFileNames.Length; i++)
                {
                    switch (invalidFileNames[i])
                    {
                    case '\\':
                    case '/':
                        CheckException <DirectoryNotFoundException>(delegate { files = Directory.GetFiles(Directory.GetCurrentDirectory(), String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly); }, String.Format("Err_631bwy_{0}! worng exception thrown: {1} - bug#387196", i, (int)invalidFileNames[i]));
                        break;

                    //We dont throw in V1 too
                    case ':':
                        //History:
                        // 1) we assumed that this will work in all non-9x machine
                        // 2) Then only in XP
                        // 3) NTFS?
                        if (Interop.IsWindows && FileSystemDebugInfo.IsCurrentDriveNTFS())     // testing NTFS
                        {
                            CheckException <IOException>(delegate { files = Directory.GetFiles(Directory.GetCurrentDirectory(), String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly); }, String.Format("Err_997gqs_{0}! worng exception thrown: {1} - bug#387196", i, (int)invalidFileNames[i]));
                        }
                        else
                        {
                            try
                            {
                                files = Directory.GetFiles(Directory.GetCurrentDirectory(), String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly);
                            }
                            catch (IOException)
                            {
                                Console.WriteLine(FileSystemDebugInfo.MachineInfo());
                                Eval(false, "Err_961lcx! Another OS throwing for DI.GetFiles(). modify the above check after confirming the v1.x behavior in that machine");
                            }
                        }

                        break;

                    case '*':
                    case '?':
                        files = Directory.GetFiles(Directory.GetCurrentDirectory(), String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly);
                        break;

                    default:
                        CheckException <ArgumentException>(delegate { files = Directory.GetFiles(Directory.GetCurrentDirectory(), String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly); }, String.Format("Err_036gza! worng exception thrown: {1} - bug#387196", i, (int)invalidFileNames[i]));
                        break;
                    }
                }
                //path too long
                CheckException <PathTooLongException>(delegate { files = Directory.GetFiles(Path.Combine(new String('a', IOInputs.MaxPath), new String('b', IOInputs.MaxPath)), "*.*", SearchOption.TopDirectoryOnly); }, String.Format("Err_927gs! wrong exception thrown"));
                CheckException <PathTooLongException>(delegate { files = Directory.GetFiles(new String('a', IOInputs.MaxPath), new String('b', IOInputs.MaxPath), SearchOption.TopDirectoryOnly); }, String.Format("Err_213aka! wrong exception thrown"));
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_995bae! Exception caught in scenario: {0}", ex);
            }

            // part II - SearchOption.AllDirectories
            //Scenario 1: Vanilla - create a directory with some files and then add a couple of directories with some files and check with searchPattern *.*
            try
            {
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                {
                    expectedFiles = fileManager.GetAllFiles();
                    list          = new List <String>(expectedFiles);
                    files         = Directory.GetFiles(dirName, "*.*", SearchOption.AllDirectories);
                    Eval(files.Length, list.Count, "Err_415mbz! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_287kkm! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_921mhs! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_415nwr! Exception caught in scenario: {0}", ex);
            }

            //Scenario 2: create a directory only top level files and directories and check
            try
            {
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 1, 10))
                {
                    expectedFiles = fileManager.GetAllFiles();
                    list          = new List <String>(expectedFiles);
                    files         = Directory.GetFiles(dirName, "*.*", SearchOption.AllDirectories);
                    Eval(files.Length, list.Count, "Err_202wur! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_611lgv! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_648ibm! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_391mwx! Exception caught in scenario: {0}", ex);
            }

            // Path is not in the current directory (same drive)
            //Scenario 3: Ensure that the path contains subdirectories and call this API and ensure that only the top directory files are returned

            /* Scenario disabled when porting because it modifies the filesystem outside of the test's working directory
             * try
             * {
             *  dirName = ManageFileSystem.GetNonExistingDir(Path.DirectorySeparatorChar.ToString(), ManageFileSystem.DirPrefixName);
             *  using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
             *  {
             *      expectedFiles = fileManager.GetAllFiles();
             *      list = new List<String>(expectedFiles);
             *      files = Directory.GetFiles(dirName, "*.*", SearchOption.AllDirectories);
             *      Eval(files.Length, list.Count, "Err_123rcm! wrong file count.");
             *      for (int i = 0; i < files.Length; i++)
             *      {
             *          //This will return as \<dirName>\<fileName> whereas our utility will return as <drive>:\<dirName>\<fileName>
             *          String fileFullName = Path.GetFullPath(files[i]);
             *          if (Eval(list.Contains(fileFullName), "Err_242yur! unexpected file found: {0}", fileFullName))
             *              list.Remove(fileFullName);
             *      }
             *      if (!Eval(list.Count == 0, "Err_477xiv! {0} expected files not found.", list.Count))
             *      {
             *          foreach (String fileName in list)
             *              Console.WriteLine(fileName);
             *      }
             *  }
             * }
             * catch (Exception ex)
             * {
             *  s_pass = false;
             *  Console.WriteLine("Err_401dkm! Exception caught in scenario: {0}", ex);
             * }
             */

            //Scenario 4: searchPattern variations - valid search characters, file match exactly the searchPattern, searchPattern is a subset of existing files, superset, no match,
            try
            {
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                String searchPattern;
                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                {
                    expectedFiles = fileManager.GetAllFiles();
                    //?
                    int maxLen = 0;
                    foreach (String file in expectedFiles)
                    {
                        String realFile = Path.GetFileNameWithoutExtension(file);
                        if (realFile.Length > maxLen)
                        {
                            maxLen = realFile.Length;
                        }
                    }
                    searchPattern = String.Format("{0}.???", new String('?', maxLen));
                    list          = new List <String>(expectedFiles);
                    files         = Directory.GetFiles(dirName, searchPattern, SearchOption.AllDirectories);
                    Eval(files.Length, list.Count, "Err_654wlf! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_792olh! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_434gew! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }

                    //file match exactly
                    searchPattern = Path.GetFileName(expectedFiles[0]);
                    list          = new List <String>(new String[] { expectedFiles[0] });
                    files         = Directory.GetFiles(dirName, searchPattern, SearchOption.AllDirectories);
                    Eval(files.Length, list.Count, "Err_427fug! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_382bzl! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_008xan! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }

                    //subset
                    String        tempSearchPattern = Path.GetFileName(expectedFiles[0]).Substring(2);
                    List <String> newFiles          = new List <String>();
                    foreach (String file in expectedFiles)
                    {
                        String realFile = Path.GetFileName(file);
                        if (realFile.Substring(2).Equals(tempSearchPattern))
                        {
                            newFiles.Add(file);
                        }
                    }
                    searchPattern = String.Format("??{0}", tempSearchPattern);

                    list  = newFiles;
                    files = Directory.GetFiles(dirName, searchPattern, SearchOption.AllDirectories);
                    Eval(files.Length, list.Count, "Err_030bfw! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_393mly! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_328gse! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }

                    //there shouldn't be any with just the suffix
                    searchPattern = tempSearchPattern;
                    list          = new List <String>();
                    files         = Directory.GetFiles(dirName, searchPattern, SearchOption.AllDirectories);
                    Eval(files.Length, list.Count, "Err_747fnq! wrong file count.");

                    //superset
                    searchPattern = String.Format("blah{0}", Path.GetFileName(expectedFiles[0]));
                    newFiles      = new List <String>();
                    foreach (String file in expectedFiles)
                    {
                        String realFile = Path.GetFileName(file);
                        if (realFile.Equals(searchPattern))
                        {
                            newFiles.Add(file);
                        }
                    }

                    list  = newFiles;
                    files = Directory.GetFiles(dirName, searchPattern, SearchOption.AllDirectories);
                    Eval(files.Length, list.Count, "Err_969vnk! wrong file count.");
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_353ygu! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_830vvw! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_983ist! Exception caught in scenario: {0}", ex);
            }

            //Scenario 6: Different local drives, Network drives (UNC and drive letters)

            /* Scenario disabled when porting because it modifies the filesystem outside of the test's working directory
             * try
             * {
             *  string otherDriveInMachine = IOServices.GetNonNtfsDriveOtherThanCurrent();
             *  if (otherDriveInMachine != null)
             *  {
             *      dirName = ManageFileSystem.GetNonExistingDir(otherDriveInMachine, ManageFileSystem.DirPrefixName);
             *      using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
             *      {
             *          expectedFiles = fileManager.GetAllFiles();
             *          list = new List<String>(expectedFiles);
             *          files = Directory.GetFiles(dirName, "*.*", SearchOption.AllDirectories);
             *          Eval(files.Length, list.Count, "Err_573sdo! wrong file count.");
             *          for (int i = 0; i < files.Length; i++)
             *          {
             *              if (Eval(list.Contains(files[i]), "Err_778kdo! unexpected file found: {0}", files[i]))
             *                  list.Remove(files[i]);
             *          }
             *          if (!Eval(list.Count == 0, "Err_954xcx! {0} expected files not found.", list.Count))
             *          {
             *              foreach (String fileName in list)
             *                  Console.WriteLine(fileName);
             *          }
             *      }
             *  }
             *
             *  // network path scenario moved to RemoteIOTests.cs
             * }
             * catch (Exception ex)
             * {
             *  s_pass = false;
             *  Console.WriteLine("Err_064vel! Exception caught in scenario: {0}", ex);
             * }
             */

            //Scenario 7: dir is readonly
            try
            {
                //Readonly
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                {
                    //now lets make this directory readonly?
                    new DirectoryInfo(dirName).Attributes = new DirectoryInfo(dirName).Attributes | FileAttributes.ReadOnly;

                    expectedFiles = fileManager.GetAllFiles();
                    list          = new List <String>(expectedFiles);
                    files         = Directory.GetFiles(dirName, "*.*", SearchOption.AllDirectories);
                    Eval(files.Length, list.Count, "Err_862vhr! wrong file count.");

                    for (int i = 0; i < files.Length; i++)
                    {
                        if (Eval(list.Contains(files[i]), "Err_556ioj! unexpected file found: {0}", files[i]))
                        {
                            list.Remove(files[i]);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_562xwh! {0} expected files not found.", list.Count))
                    {
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                    if (Directory.Exists(dirName) && (new DirectoryInfo(dirName).Attributes & FileAttributes.ReadOnly) != 0)
                    {
                        new DirectoryInfo(dirName).Attributes = new DirectoryInfo(dirName).Attributes ^ FileAttributes.ReadOnly;
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_418qfv! Exception caught in scenario: {0}", ex);
            }
        }
        catch (Exception ex)
        {
            s_pass = false;
            Console.WriteLine("Err_234rsgf! Uncaught exception in RunTest: {0}", ex);
        }

        Assert.True(s_pass);
    }
示例#6
0
    [PlatformSpecific(PlatformID.Windows)] // testing volumes / mounts / drive letters
    public static void RunTest()
    {
        try
        {
            const String MountPrefixName = "LaksMount";

            String mountedDirName;
            String dirName;
            String dirNameWithoutRoot;
            String dirNameReferedFromMountedDrive;

            //Adding debug info since this test hangs sometime in RTS runs
            String debugFileName = "Co7604Delete_MountVolume_Debug.txt";
            DeleteFile(debugFileName);
            String scenarioDescription;

            scenarioDescription = "Scenario 1: Vanilla - Different drive is mounted on the current drive";
            try
            {
                File.AppendAllText(debugFileName, String.Format("{0}{1}", scenarioDescription, Environment.NewLine));

                string otherDriveInMachine = IOServices.GetNtfsDriveOtherThanCurrent();
                //out labs use UIP tools in one drive and dont expect this drive to be used by others. We avoid this problem by not testing if the other drive is not NTFS
                if (FileSystemDebugInfo.IsCurrentDriveNTFS() && otherDriveInMachine != null)
                {
                    Console.WriteLine(scenarioDescription);
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(Path.DirectorySeparatorChar.ToString(), MountPrefixName));

                    try
                    {
                        Directory.CreateDirectory(mountedDirName);

                        File.AppendAllText(debugFileName, String.Format("Mounting on {0}{1}{2}", otherDriveInMachine.Substring(0, 2), mountedDirName, Environment.NewLine));
                        MountHelper.Mount(otherDriveInMachine.Substring(0, 2), mountedDirName);

                        dirName = ManageFileSystem.GetNonExistingDir(otherDriveInMachine, ManageFileSystem.DirPrefixName);
                        File.AppendAllText(debugFileName, String.Format("Creating a sub tree at: {0}{1}", dirName, Environment.NewLine));
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                        {
                            Eval(Directory.Exists(dirName), "Err_3974g! Directory {0} doesn't exist: {1}", dirName, Directory.Exists(dirName));
                            //Lets refer to these via mounted drive and check
                            dirNameWithoutRoot             = dirName.Substring(3);
                            dirNameReferedFromMountedDrive = Path.Combine(mountedDirName, dirNameWithoutRoot);
                            Directory.Delete(dirNameReferedFromMountedDrive, true);
                            Task.Delay(300).Wait();
                            Eval(!Directory.Exists(dirName), "Err_20387g! Directory {0} still exist: {1}", dirName, Directory.Exists(dirName));
                        }
                    }
                    finally
                    {
                        MountHelper.Unmount(mountedDirName);
                        DeleteDir(mountedDirName, true);
                    }
                    File.AppendAllText(debugFileName, String.Format("Completed scenario {0}", Environment.NewLine));
                }
                else
                {
                    File.AppendAllText(debugFileName, String.Format("Scenario 1 - Vanilla - NOT RUN: Different drive is mounted on the current drive {0}", Environment.NewLine));
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_768lme! Exception caught in scenario: {0}", ex);
            }

            scenarioDescription = "Scenario 2: Current drive is mounted on a different drive";
            Console.WriteLine(scenarioDescription);
            File.AppendAllText(debugFileName, String.Format("{0}{1}", scenarioDescription, Environment.NewLine));
            try
            {
                string otherDriveInMachine = IOServices.GetNtfsDriveOtherThanCurrent();
                if (otherDriveInMachine != null)
                {
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(otherDriveInMachine.Substring(0, 3), MountPrefixName));
                    try
                    {
                        Directory.CreateDirectory(mountedDirName);

                        File.AppendAllText(debugFileName, String.Format("Mounting on {0}{1}{2}", Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName, Environment.NewLine));
                        MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);

                        dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                        File.AppendAllText(debugFileName, String.Format("Creating a sub tree at: {0}{1}", dirName, Environment.NewLine));
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                        {
                            Eval(Directory.Exists(dirName), "Err_239ufz! Directory {0} doesn't exist: {1}", dirName, Directory.Exists(dirName));
                            //Lets refer to these via mounted drive and check
                            dirNameWithoutRoot             = dirName.Substring(3);
                            dirNameReferedFromMountedDrive = Path.Combine(mountedDirName, dirNameWithoutRoot);
                            Directory.Delete(dirNameReferedFromMountedDrive, true);
                            Task.Delay(300).Wait();
                            Eval(!Directory.Exists(dirName), "Err_794aiu! Directory {0} still exist: {1}", dirName, Directory.Exists(dirName));
                        }
                    }
                    finally
                    {
                        MountHelper.Unmount(mountedDirName);
                        DeleteDir(mountedDirName, true);
                    }
                    File.AppendAllText(debugFileName, String.Format("Completed scenario {0}", Environment.NewLine));
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_231vwf! Exception caught in scenario: {0}", ex);
            }

            //scenario 3.1: Current drive is mounted on current drive
            scenarioDescription = "Scenario 3.1 - Current drive is mounted on current drive";
            try
            {
                if (FileSystemDebugInfo.IsCurrentDriveNTFS())
                {
                    File.AppendAllText(debugFileName, String.Format("{0}{1}", scenarioDescription, Environment.NewLine));
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(Path.DirectorySeparatorChar.ToString(), MountPrefixName));
                    try
                    {
                        Directory.CreateDirectory(mountedDirName);

                        File.AppendAllText(debugFileName, String.Format("Mounting on {0}{1}{2}", Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName, Environment.NewLine));
                        MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);

                        dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                        File.AppendAllText(debugFileName, String.Format("Creating a sub tree at: {0}{1}", dirName, Environment.NewLine));
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                        {
                            Eval(Directory.Exists(dirName), "Err_324eez! Directory {0} doesn't exist: {1}", dirName, Directory.Exists(dirName));
                            //Lets refer to these via mounted drive and check
                            dirNameWithoutRoot             = dirName.Substring(3);
                            dirNameReferedFromMountedDrive = Path.Combine(mountedDirName, dirNameWithoutRoot);
                            Directory.Delete(dirNameReferedFromMountedDrive, true);
                            Task.Delay(300).Wait();
                            Eval(!Directory.Exists(dirName), "Err_195whv! Directory {0} still exist: {1}", dirName, Directory.Exists(dirName));
                        }
                    }
                    finally
                    {
                        MountHelper.Unmount(mountedDirName);
                        DeleteDir(mountedDirName, true);
                    }
                    File.AppendAllText(debugFileName, String.Format("Completed scenario {0}", Environment.NewLine));
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_493ojg! Exception caught in scenario: {0}", ex);
            }

            //scenario 3.2: Current drive is mounted on current directory
            scenarioDescription = "Scenario 3.2 - Current drive is mounted on current directory";
            try
            {
                if (FileSystemDebugInfo.IsCurrentDriveNTFS())
                {
                    File.AppendAllText(debugFileName, String.Format("{0}{1}", scenarioDescription, Environment.NewLine));
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), MountPrefixName));
                    try
                    {
                        Directory.CreateDirectory(mountedDirName);

                        File.AppendAllText(debugFileName, String.Format("Mounting on {0}{1}{2}", Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName, Environment.NewLine));
                        MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);

                        dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                        File.AppendAllText(debugFileName, String.Format("Creating a sub tree at: {0}{1}", dirName, Environment.NewLine));
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                        {
                            Eval(Directory.Exists(dirName), "Err_951ipb! Directory {0} doesn't exist: {1}", dirName, Directory.Exists(dirName));
                            //Lets refer to these via mounted drive and check
                            dirNameWithoutRoot             = dirName.Substring(3);
                            dirNameReferedFromMountedDrive = Path.Combine(mountedDirName, dirNameWithoutRoot);
                            Directory.Delete(dirNameReferedFromMountedDrive, true);
                            Task.Delay(300).Wait();
                            Eval(!Directory.Exists(dirName), "Err_493yin! Directory {0} still exist: {1}", dirName, Directory.Exists(dirName));
                        }
                    }
                    finally
                    {
                        MountHelper.Unmount(mountedDirName);
                        DeleteDir(mountedDirName, true);
                    }
                    File.AppendAllText(debugFileName, String.Format("Completed scenario {0}", Environment.NewLine));
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_432qcp! Exception caught in scenario: {0}", ex);
            }

            //@WATCH - potentially dangerous code - can delete the whole drive!!
            //scenario 3.3: we call delete on the mounted volume - this should only delete the mounted drive?
            //Current drive is mounted on current directory
            scenarioDescription = "Scenario 3.3 - we call delete on the mounted volume";
            try
            {
                if (FileSystemDebugInfo.IsCurrentDriveNTFS())
                {
                    File.AppendAllText(debugFileName, String.Format("{0}{1}", scenarioDescription, Environment.NewLine));
                    mountedDirName = Path.GetFullPath(ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), MountPrefixName));
                    try
                    {
                        Directory.CreateDirectory(mountedDirName);

                        File.AppendAllText(debugFileName, String.Format("Mounting on {0}{1}{2}", Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName, Environment.NewLine));
                        MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);

                        Directory.Delete(mountedDirName, true);
                        Task.Delay(300).Wait();
                    }
                    finally
                    {
                        if (!Eval(!Directory.Exists(mountedDirName), "Err_001yph! Directory {0} still exist: {1}", mountedDirName, Directory.Exists(mountedDirName)))
                        {
                            MountHelper.Unmount(mountedDirName);
                            DeleteDir(mountedDirName, true);
                        }
                    }
                    File.AppendAllText(debugFileName, String.Format("Completed scenario {0}", Environment.NewLine));
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_386rpj! Exception caught in scenario: {0}", ex);
            }

            //@WATCH - potentially dangerous code - can delete the whole drive!!
            //scenario 3.4: we call delete on parent directory of the mounted volume, the parent directoriy will have some other directories and files
            //Current drive is mounted on current directory
            scenarioDescription = "Scenario 3.4 - we call delete on parent directory of the mounted volume, the parent directoriy will have some other directories and files";
            try
            {
                if (FileSystemDebugInfo.IsCurrentDriveNTFS())
                {
                    File.AppendAllText(debugFileName, String.Format("{0}{1}", scenarioDescription, Environment.NewLine));
                    mountedDirName = null;
                    try
                    {
                        dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                        File.AppendAllText(debugFileName, String.Format("Creating a sub tree at: {0}{1}", dirName, Environment.NewLine));
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 2, 20))
                        {
                            Eval(Directory.Exists(dirName), "Err_469yvh! Directory {0} doesn't exist: {1}", dirName, Directory.Exists(dirName));
                            String[] dirs = fileManager.GetDirectories(1);
                            mountedDirName = Path.GetFullPath(dirs[0]);
                            if (Eval(Directory.GetDirectories(mountedDirName).Length == 0, "Err_974tsg! the sub directory has directories: {0}", mountedDirName))
                            {
                                foreach (String file in Directory.GetFiles(mountedDirName))
                                {
                                    File.Delete(file);
                                }
                                if (Eval(Directory.GetFiles(mountedDirName).Length == 0, "Err_13ref! the mounted directory has files: {0}", mountedDirName))
                                {
                                    File.AppendAllText(debugFileName, String.Format("Mounting on {0}{1}{2}", Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName, Environment.NewLine));
                                    MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);
                                    //now lets call delete on the parent directory
                                    Directory.Delete(dirName, true);
                                    Task.Delay(300).Wait();
                                    Eval(!Directory.Exists(dirName), "Err_006jsf! Directory {0} still exist: {1}", dirName, Directory.Exists(dirName));
                                    Console.WriteLine("Completed Scenario 3.4");
                                }
                            }
                        }
                    }
                    finally
                    {
                        if (!Eval(!Directory.Exists(mountedDirName), "Err_625ckx! Directory {0} still exist: {1}", mountedDirName, Directory.Exists(mountedDirName)))
                        {
                            MountHelper.Unmount(mountedDirName);
                            DeleteDir(mountedDirName, true);
                        }
                    }
                    File.AppendAllText(debugFileName, String.Format("Completed scenario {0}", Environment.NewLine));
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_578tni! Exception caught in scenario: {0}", ex);
            }

            //@WATCH - potentially dangerous code - can delete the whole drive!!
            //scenario 3.5: we call delete on parent directory of the mounted volume, the parent directoriy will have some other directories and files
            //we call a different directory than the first
            //Current drive is mounted on current directory
            scenarioDescription = "Scenario 3.5 - we call delete on parent directory of the mounted volume, the parent directoriy will have some other directories and files";
            try
            {
                if (FileSystemDebugInfo.IsCurrentDriveNTFS())
                {
                    File.AppendAllText(debugFileName, String.Format("{0}{1}", scenarioDescription, Environment.NewLine));
                    mountedDirName = null;
                    try
                    {
                        dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                        File.AppendAllText(debugFileName, String.Format("Creating a sub tree at: {0}{1}", dirName, Environment.NewLine));
                        using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 2, 30))
                        {
                            Eval(Directory.Exists(dirName), "Err_715tdq! Directory {0} doesn't exist: {1}", dirName, Directory.Exists(dirName));
                            String[] dirs = fileManager.GetDirectories(1);
                            mountedDirName = Path.GetFullPath(dirs[0]);
                            if (dirs.Length > 1)
                            {
                                mountedDirName = Path.GetFullPath(dirs[1]);
                            }
                            if (Eval(Directory.GetDirectories(mountedDirName).Length == 0, "Err_492qwl! the sub directory has directories: {0}", mountedDirName))
                            {
                                foreach (String file in Directory.GetFiles(mountedDirName))
                                {
                                    File.Delete(file);
                                }
                                if (Eval(Directory.GetFiles(mountedDirName).Length == 0, "Err_904kij! the mounted directory has files: {0}", mountedDirName))
                                {
                                    File.AppendAllText(debugFileName, String.Format("Mounting on {0}{1}{2}", Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName, Environment.NewLine));
                                    MountHelper.Mount(Directory.GetCurrentDirectory().Substring(0, 2), mountedDirName);
                                    //now lets call delete on the parent directory
                                    Directory.Delete(dirName, true);
                                    Task.Delay(300).Wait();
                                    Eval(!Directory.Exists(dirName), "Err_900edl! Directory {0} still exist: {1}", dirName, Directory.Exists(dirName));
                                    Console.WriteLine("Completed Scenario 3.5: {0}", mountedDirName);
                                }
                            }
                        }
                    }
                    finally
                    {
                        if (!Eval(!Directory.Exists(mountedDirName), "Err_462xtc! Directory {0} still exist: {1}", mountedDirName, Directory.Exists(mountedDirName)))
                        {
                            MountHelper.Unmount(mountedDirName);
                            DeleteDir(mountedDirName, true);
                        }
                    }
                    File.AppendAllText(debugFileName, String.Format("Completed scenario {0}", Environment.NewLine));
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_471jli! Exception caught in scenario: {0}", ex);
            }
        }
        catch (Exception ex)
        {
            s_pass = false;
            Console.WriteLine("Err_234rsgf! Uncaught exception in RunTest: {0}", ex);
        }
        finally
        {
            Assert.True(s_pass);
        }
    }
示例#7
0
    public static void RunTest()
    {
        try
        {
            String        dirName;
            DirectoryInfo dirInfo;
            String[]      expectedFiles;
            FileInfo[]    files;
            List <String> list;

            //Scenario 1: Vanilla
            try
            {
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);

                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                {
                    dirInfo       = new DirectoryInfo(dirName);
                    expectedFiles = fileManager.GetAllFiles();
                    list          = new List <String>(expectedFiles);
                    files         = dirInfo.GetFiles("*.*", SearchOption.AllDirectories);
                    Eval(files.Length == list.Count, "Err_415mbz! wrong count");
                    for (int i = 0; i < expectedFiles.Length; i++)
                    {
                        if (Eval(list.Contains(files[i].FullName), "Err_287kkm! No file found: {0}", files[i].FullName))
                        {
                            list.Remove(files[i].FullName);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_921mhs! wrong count: {0}", list.Count))
                    {
                        Console.WriteLine();
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_349t7g! Exception caught in scenario: {0}", ex);
            }

            //Scenario 3: Parm Validation
            try
            {
                // dir not present and then after creating
                dirName = ManageFileSystem.GetNonExistingDir(Directory.GetCurrentDirectory(), ManageFileSystem.DirPrefixName);
                dirInfo = new DirectoryInfo(dirName);
                CheckException <DirectoryNotFoundException>(delegate { files = dirInfo.GetFiles("*.*", SearchOption.AllDirectories); }, "Err_326pgt! worng exception thrown");

                // create the dir and then check that we dont cache this info
                using (ManageFileSystem fileManager = new ManageFileSystem(dirName, 3, 100))
                {
                    dirInfo       = new DirectoryInfo(dirName);
                    expectedFiles = fileManager.GetAllFiles();
                    list          = new List <String>(expectedFiles);
                    files         = dirInfo.GetFiles("*.*", SearchOption.AllDirectories);
                    Eval(files.Length == list.Count, "Err_948kxt! wrong count");
                    for (int i = 0; i < expectedFiles.Length; i++)
                    {
                        if (Eval(list.Contains(files[i].FullName), "Err_535xaj! No file found: {0}", files[i].FullName))
                        {
                            list.Remove(files[i].FullName);
                        }
                    }
                    if (!Eval(list.Count == 0, "Err_370pjl! wrong count: {0}", list.Count))
                    {
                        Console.WriteLine();
                        foreach (String fileName in list)
                        {
                            Console.WriteLine(fileName);
                        }
                    }
                    CheckException <ArgumentNullException>(delegate { files = dirInfo.GetFiles(null, SearchOption.TopDirectoryOnly); }, "Err_751mwu! worng exception thrown");
                    CheckException <ArgumentOutOfRangeException>(delegate { files = dirInfo.GetFiles("*.*", (SearchOption)100); }, "Err_589kvu! worng exception thrown - see bug #386545");
                    CheckException <ArgumentOutOfRangeException>(delegate { files = dirInfo.GetFiles("*.*", (SearchOption)(-1)); }, "Err_359vcj! worng exception thrown - see bug #386545");
                    String[] invalidValuesForSearch = { "..", @"..\" };
                    for (int i = 0; i < invalidValuesForSearch.Length; i++)
                    {
                        CheckException <ArgumentException>(delegate { files = dirInfo.GetFiles(invalidValuesForSearch[i], SearchOption.TopDirectoryOnly); }, String.Format("Err_631bwy! worng exception thrown: {1}", i, invalidValuesForSearch[i]));
                    }
                    Char[] invalidFileNames = Path.GetInvalidFileNameChars();
                    for (int i = 0; i < invalidFileNames.Length; i++)
                    {
                        switch (invalidFileNames[i])
                        {
                        case '\\':
                        case '/':
                            CheckException <DirectoryNotFoundException>(delegate { files = dirInfo.GetFiles(String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly); }, String.Format("Err_631bwy_{0}! worng exception thrown: {1} - bug#387196", i, (int)invalidFileNames[i]));
                            break;

                        case ':':
                            //History:
                            // 1) we assumed that this will work in all non-9x machine
                            // 2) Then only in XP
                            // 3) NTFS?
                            if (FileSystemDebugInfo.IsCurrentDriveNTFS())
                            {
                                CheckException <IOException>(delegate { files = dirInfo.GetFiles(String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly); }, String.Format("Err_997gqs! worng exception thrown: {1} - bug#387196", i, (int)invalidFileNames[i]));
                            }
                            else
                            {
                                try
                                {
                                    files = dirInfo.GetFiles(String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly);
                                }
                                catch (IOException)
                                {
                                    Console.WriteLine(FileSystemDebugInfo.MachineInfo());
                                    Eval(false, "Err_3947g! Another OS throwing for DI.GetFiles(). modify the above check after confirming the v1.x behavior in that machine");

                                    /**
                                     *      try
                                     *      {
                                     *            DirectoryInfo dirInfo = new DirectoryInfo(".");
                                     *          FileInfo[] files = dirInfo.GetFiles("te:st");
                                     *      pass=false;
                                     *      Console.WriteLine("No exception thrown");
                                     *      }
                                     *  catch(IOException){}
                                     *      catch (Exception ex)
                                     *      {
                                     *      pass=false;
                                     *      Console.WriteLine("Err_723jvl! Different Exception caught in scenario: {0}", ex);
                                     *      }
                                     *
                                     **/
                                }
                            }
                            break;

                        case '*':
                        case '?':
                            files = dirInfo.GetFiles(String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly);
                            break;

                        default:
                            CheckException <ArgumentException>(delegate { files = dirInfo.GetFiles(String.Format("te{0}st", invalidFileNames[i].ToString()), SearchOption.TopDirectoryOnly); }, String.Format("Err_036gza! worng exception thrown: {1} - bug#387196", i, (int)invalidFileNames[i]));
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                s_pass = false;
                Console.WriteLine("Err_006dwq! Exception caught in scenario: {0}", ex);
            }

            //Scenario for bug #461014 - Getting files/directories of CurrentDirectory of drives are broken

            /* Test disabled while porting because it relies on state outside of its working directory not changing over time
             * try
             * {
             *  string anotherDrive = IOServices.GetNtfsDriveOtherThanCurrent();
             *  String[] paths = null == anotherDrive ? new String[] { Directory.GetCurrentDirectory() } : new String[] { anotherDrive, Directory.GetCurrentDirectory() };
             *  String path;
             *
             *  for (int i = 0; i < paths.Length; i++)
             *  {
             *      path = paths[i];
             *      if (path.Length > 1)
             *      {
             *          path = path.Substring(0, 2);
             *
             *          FileInfo[] f1 = new DirectoryInfo(Path.GetFullPath(path)).GetFiles();
             *          FileInfo[] f2 = new DirectoryInfo(path).GetFiles();
             *          Eval<int>(f1.Length, f2.Length, "Err_2497gds! wrong value");
             *          for (int j = 0; j < f1.Length; j++)
             *          {
             *              Eval<String>(f1[j].FullName, f2[j].FullName, "Err_03284t! wrong value");
             *              Eval<String>(f1[j].Name, f2[j].Name, "Err_03284t! wrong value");
             *          }
             *      }
             *  }
             * }
             * catch (Exception ex)
             * {
             *  s_pass = false;
             *  Console.WriteLine("Err_349t7g! Exception caught in scenario: {0}", ex);
             * }
             */
        }
        catch (Exception ex)
        {
            s_pass = false;
            Console.WriteLine("Err_234rsgf! Uncaught exception in RunTest: {0}", ex);
        }


        Assert.True(s_pass);
    }