public void SaveSettingsToStorageCreatesNewRegistryKey() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.SaveSettingsToStorage(); Assert.IsTrue(this.GetTestRegistryKey().GetSubKeyNames().Single() == "T4 Toolbox"); }
public void SaveSettingsToStorageDisposesRootKey() { RegistryKey rootKey = this.GetTestRegistryKey(); var options = new TestableT4ToolboxOptions(() => rootKey); options.SaveSettingsToStorage(); rootKey.GetValueNames(); // ObjectDisposedException here }
public void SaveSettingsToStorageUsesExistingRegistryKey() { using (RegistryKey existingKey = this.GetTestRegistryKey().CreateSubKey("T4 Toolbox")) { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.SaveSettingsToStorage(); Assert.IsTrue(existingKey.GetValueNames().Any()); } }
public void SaveSettingsToStorageWritesPropertyValuesToRegistryKey() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.SaveSettingsToStorage(); using (RegistryKey rootKey = this.GetTestRegistryKey()) using (RegistryKey settingsKey = rootKey.OpenSubKey("T4 Toolbox")) { Assert.AreEqual(options.SyntaxColorizationEnabled.ToString(), settingsKey.GetValue("SyntaxColorizationEnabled")); } }