Beispiel #1
0
        public void DeleteKey_ForExistentKeyWithSubkeys()
        {
            AdvRegistry.CreateKey(ExistentKeyPath + "\\Subkey1");
            AdvRegistry.CreateKey(ExistentKeyPath + "\\Subkey2");

            AdvRegistry.DeleteKey(ExistentKeyPath);
            Assert.IsFalse(AdvRegistry.IsKeyExists(ExistentKeyPath));
        }
Beispiel #2
0
        private static int Benchmark(Ruleset ruleset, int benchmarkTime)
        {
            int accessCounter = 0;

            var time = DateTime.Now.AddMinutes(benchmarkTime);

            while (DateTime.Now < time)
            {
                foreach (Ruleset.PathsRow path in ruleset.Paths)
                {
                    // Try to open every file in list.
                    foreach (var fsPath in ExpandFSPaths(path))
                    {
                        FileStream file = null;
                        try
                        {
                            if (File.Exists(fsPath))
                            {
                                file = File.Open(fsPath, FileMode.Open, FileAccess.Read);
                            }
                        }
                        catch
                        {
                        }
                        finally
                        {
                            if (file != null)
                            {
                                file.Close();
                            }
                        }
                    }

                    if (AdvRegistry.IsRegistryPath(path.Path) && AdvRegistry.IsKeyExists(path.Path))
                    {
                        AdvRegistry.GetValueData(path.Path);
                    }
                }
                accessCounter++;
                Console.Write(".");
            }
            Console.WriteLine();

            return(accessCounter);
        }
Beispiel #3
0
 public void DeleteKey_ForExistentKey()
 {
     AdvRegistry.DeleteKey(ExistentKeyPath);
     Assert.IsFalse(AdvRegistry.IsKeyExists(ExistentKeyPath));
 }
Beispiel #4
0
 public void IsKeyExists()
 {
     Assert.AreEqual(AdvRegistry.IsKeyExists(ExistentKeyPath), true);
     Assert.AreEqual(AdvRegistry.IsKeyExists(NonexistentKeyPath), false);
 }