示例#1
0
        public void TestSetValue2()
        {
            try {
                Microsoft.VisualBasic.MyServices.RegistryProxy registry = getProxy();
                string name      = ".someweirdthing";
                string keyname   = "HKEY_CLASSES_ROOT\\" + name;
                string valuename = ".name";
                registry.SetValue(keyname, valuename, 1);
                object value = registry.GetValue(keyname, valuename, 2);
                Assert.AreEqual(1, value, "#01");
                registry.SetValue(keyname, valuename, 3, Microsoft.Win32.RegistryValueKind.DWord);
                value = registry.GetValue(keyname, valuename, 3);
                Assert.AreEqual(3, value, "#02");

                registry.ClassesRoot.DeleteSubKey(name);
            } catch (System.Security.SecurityException ex) {
                Assert.Ignore(ex.Message);
            }
        }
示例#2
0
 public void TestGetValue()
 {
     try {
         Microsoft.VisualBasic.MyServices.RegistryProxy registry = getProxy();
         object value = registry.GetValue("HKEY_CLASSES_ROOT", ".txt", "a");
         Assert.AreEqual("a", value, "#01");
     } catch (System.Security.SecurityException ex) {
         Assert.Ignore(ex.Message);
     }
 }