public void LoadSettingsFromStorageDoesNotChangePropertiesWhenRegistryKeyDoesNotExist() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.LoadSettingsFromStorage(); Assert.IsTrue(options.SyntaxColorizationEnabled); }
public void SaveSettingsToStorageCreatesNewRegistryKey() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.SaveSettingsToStorage(); Assert.IsTrue(this.GetTestRegistryKey().GetSubKeyNames().Single() == "T4 Toolbox"); }
public void ResetSettingsDisposesRootKey() { RegistryKey rootKey = this.GetTestRegistryKey(); var options = new TestableT4ToolboxOptions(() => rootKey); options.ResetSettings(); rootKey.GetValueNames(); // ObjectDisposedException here }
public void ResetSettingsChangesPropertiesWithoutDefaultValueAttributeToDefaultTypeValue() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.BoolPropertyWithoutDefaultValueAttribute = true; options.ResetSettings(); Assert.IsFalse(options.BoolPropertyWithoutDefaultValueAttribute); }
public void ResetSettingsChangesPropertiesToValuesSpecifiedInDefaultValueAttribute() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.SyntaxColorizationEnabled = false; options.ResetSettings(); Assert.IsTrue(options.SyntaxColorizationEnabled); }
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 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 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")); } }
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 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 ResetSettingsDeletesRegistryKey() { using (RegistryKey rootKey = this.GetTestRegistryKey()) { rootKey.CreateSubKey("T4 Toolbox"); } var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.ResetSettings(); using (RegistryKey root = this.GetTestRegistryKey()) { Assert.IsFalse(root.GetSubKeyNames().Any()); } }
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); }
public void ConstructorInitializesPropertiesWithoutDefaultValueAttribute() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); Assert.IsFalse(options.BoolPropertyWithoutDefaultValueAttribute); }
public void ResetSettingsChangesPropertiesToValuesSpecifiedInDefaultValueAttribute() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.SyntaxColorizationEnabled = false; options.ResetSettings(); Assert.IsTrue(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); }
public void LoadSettingsFromStorageDoesNotChangePropertiesWhenRegistryKeyDoesNotExist() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.LoadSettingsFromStorage(); Assert.IsTrue(options.SyntaxColorizationEnabled); }
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 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")); } }
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 ResetSettingsDoesNotThrowWhenRegistryKeyDoesNotExist() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.ResetSettings(); }
public void ResetSettingsDoesNotThrowWhenRegistryKeyDoesNotExist() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.ResetSettings(); }
public void ResetSettingsChangesPropertiesWithoutDefaultValueAttributeToDefaultTypeValue() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.BoolPropertyWithoutDefaultValueAttribute = true; options.ResetSettings(); Assert.IsFalse(options.BoolPropertyWithoutDefaultValueAttribute); }
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 ResetSettingsDeletesRegistryKey() { using (RegistryKey rootKey = this.GetTestRegistryKey()) { rootKey.CreateSubKey("T4 Toolbox"); } var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.ResetSettings(); using (RegistryKey root = this.GetTestRegistryKey()) { Assert.IsFalse(root.GetSubKeyNames().Any()); } }
public void ConstructorInitializesPropertiesWithoutDefaultValueAttribute() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); Assert.IsFalse(options.BoolPropertyWithoutDefaultValueAttribute); }
public void ResetSettingsDisposesRootKey() { RegistryKey rootKey = this.GetTestRegistryKey(); var options = new TestableT4ToolboxOptions(() => rootKey); options.ResetSettings(); rootKey.GetValueNames(); // ObjectDisposedException here }
public void SaveSettingsToStorageCreatesNewRegistryKey() { var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey); options.SaveSettingsToStorage(); Assert.IsTrue(this.GetTestRegistryKey().GetSubKeyNames().Single() == "T4 Toolbox"); }