public void RegistryDeleteValueTest() { var helper = new RegistryWrapper(); helper.WriteValue(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE", RegistryWrapper.RegistryVersion.Only64Bit, new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("TestKey", "TestValue") }); helper.DeleteValue(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE", "TestKey", RegistryWrapper.RegistryVersion.Only64Bit); Assert.IsFalse(helper.ReadKey(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE", RegistryWrapper.RegistryVersion.Only64Bit) ._64BitValues.Contains(new KeyValuePair <string, object>("TestKey", "TestValue")), "Given key still contains value after delete attempt."); }
public void RegistryReadTest() { var helper = new RegistryWrapper(); helper.WriteValue(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE", RegistryWrapper.RegistryVersion.Only64Bit, new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("TestKey1", "TestValue1") }); var result = helper.ReadKey(@"HKEY_LOCAL_MACHINE\SOFTWARE", RegistryWrapper.RegistryVersion.Only64Bit); foreach (var item in result._64BitValues) { Debug.WriteLine("Key: " + item.Key + " Value: " + item.Value); } Assert.IsNotNull(result, "The given key has no values"); Assert.IsTrue(result._64BitValues.Count > 0); helper.DeleteValue(RegistryWrapper.RegistryKeyRoot.LocalMachine, @"SOFTWARE", @"TestKey1", RegistryWrapper.RegistryVersion.Only64Bit); }