public void LoadSettingsFromStorageDoesNotChangePropertiesWhenRegistryKeyDoesNotExist() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.LoadSettingsFromStorage(); Assert.IsTrue(options.SyntaxColorizationEnabled); }
public void LoadSettingsFromStorageDisposesRootKey() { RegistryKey rootKey = this.GetTestRegistryKey(); var options = new TestableT4ToolboxOptions(() => rootKey); options.LoadSettingsFromStorage(); rootKey.GetValueNames(); // ObjectDisposedException here }
public void LoadSettingsFromStorageDoesNotChangePropertyWhenRegistryValueDoesNotExist() { using (RegistryKey rootKey = this.GetTestRegistryKey()) using (RegistryKey settingsKey = rootKey.CreateSubKey("T4 Toolbox")) { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.LoadSettingsFromStorage(); Assert.IsTrue(options.SyntaxColorizationEnabled); } }
public void LoadSettingsFromStorageConvertsRegistryValuesToPropertyTypeForBackwardCompatibility() { using (RegistryKey rootKey = this.GetTestRegistryKey()) using (RegistryKey settingsKey = rootKey.CreateSubKey("T4 Toolbox")) { settingsKey.SetValue("SyntaxColorizationEnabled", 0, RegistryValueKind.DWord); var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.LoadSettingsFromStorage(); Assert.IsFalse(options.SyntaxColorizationEnabled); } }
public void LoadSettingsFromStorageReadsPropertyValuesFromRegistryKey() { using (RegistryKey rootKey = this.GetTestRegistryKey()) using (RegistryKey settingsKey = rootKey.CreateSubKey("T4 Toolbox")) { settingsKey.SetValue("SyntaxColorizationEnabled", "False"); var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.LoadSettingsFromStorage(); Assert.IsFalse(options.SyntaxColorizationEnabled); } }
public void LoadSettingsFromStorageRaisesPropertyChangedEvent() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); using (RegistryKey rootKey = this.GetTestRegistryKey()) using (RegistryKey settingsKey = rootKey.CreateSubKey("T4 Toolbox")) { settingsKey.SetValue("SyntaxColorizationEnabled", false, RegistryValueKind.DWord); } bool propertyChanged = false; options.PropertyChanged += (sender, args) => propertyChanged = true; options.LoadSettingsFromStorage(); Assert.IsTrue(propertyChanged); }