public void ProperlyInitializeProperties_WhenCalledWithHKCU() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("AddRegKeyToHKCU.CustAct")); // Act // Assert Assert.AreEqual(action.Hive, "HKey_Current_User"); Assert.AreEqual(action.RegKey, @"SOFTWARE\EasyCompany\Wsus Package Publisher\Test"); }
public void ProperlyInitializeProperties_WhenCalledWithHKLM64() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("AddRegKeyToHKLM64.CustAct")); // Act // Assert Assert.AreEqual(action.Hive, "HKey_Local_Machine"); Assert.AreEqual(action.RegKey, @"SOFTWARE\EasyCompany\Wsus Package Publisher\Test"); Assert.IsFalse(action.UseReg32); }
public void CreateTheRegKey_WhenCalledWithHKLM() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("AddRegKeyToHKLM.CustAct")); RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry32); RegistryKey targetKey = hklm.OpenSubKey(action.RegKey, false); var finalResult = Tools.GetReturnCodeAction(); // Act if (targetKey != null) { hklm.DeleteSubKey(action.RegKey); targetKey = null; } action.Run(ref finalResult); targetKey = hklm.OpenSubKey(action.RegKey, false); // Assert Assert.IsNotNull(targetKey); }