public void RegistryDeleteSubKeyTreeTest() { var helper = new RegistryWrapper(); helper.WriteSubKey(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE\Charlie", RegistryWrapper.RegistryVersion.Only64Bit); helper.WriteSubKey(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE\Charlie\Test", RegistryWrapper.RegistryVersion.Only64Bit, new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("Key1", "Value1") }); helper.DeleteSubKeyTree(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE\Charlie", RegistryWrapper.RegistryVersion.Only64Bit); Assert.IsTrue(helper.ReadKey(@"SOFTWARE\Charlie", RegistryWrapper.RegistryVersion.Only64Bit)._64BitValues.Count == 0); }
public void RegistryWriteSubKeyTest() { var helper = new RegistryWrapper(); helper.WriteSubKey(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE\Test", RegistryWrapper.RegistryVersion.Only64Bit, new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("Key1", "Value1"), new KeyValuePair <string, object>("Key2 ", "Value2"), new KeyValuePair <string, object>("Key3", "Value3") }); Assert.IsNotNull(helper.ReadKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Test", RegistryWrapper.RegistryVersion.Only64Bit)._64BitValues, "No value at specified subKey after write attempt."); helper.DeleteSubKeyTree(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE\Test", RegistryWrapper.RegistryVersion.Only64Bit); }
public void RegistryWriteToBothTest() { var helper = new RegistryWrapper(); helper.WriteValue(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE\Test\TestLayer2", RegistryWrapper.RegistryVersion.Both, new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("Alice", "Allison"), new KeyValuePair <string, object>("Bob", "Boberson") }); var result = helper.ReadKey(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE\Test\TestLayer2", RegistryWrapper.RegistryVersion.Both); Assert.IsTrue(result._64BitValues.Contains(new KeyValuePair <string, object>("Alice", "Allison"))); Assert.IsTrue(result._32BitValues.Contains(new KeyValuePair <string, object>("Alice", "Allison"))); helper.DeleteSubKeyTree(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE\Test", RegistryWrapper.RegistryVersion.Both); }