Exemplo n.º 1
0
        public void LoadSettingsFromStorageDoesNotChangePropertiesWhenRegistryKeyDoesNotExist()
        {
            var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey);

            options.LoadSettingsFromStorage();
            Assert.IsTrue(options.SyntaxColorizationEnabled);
        }
Exemplo n.º 2
0
        public void LoadSettingsFromStorageDisposesRootKey()
        {
            RegistryKey rootKey = this.GetTestRegistryKey();
            var         options = new TestableT4ToolboxOptions(() => rootKey);

            options.LoadSettingsFromStorage();
            rootKey.GetValueNames(); // ObjectDisposedException here
        }
Exemplo n.º 3
0
 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);
         }
 }
Exemplo n.º 4
0
 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);
         }
 }
Exemplo n.º 5
0
 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);
         }
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
 public void LoadSettingsFromStorageDisposesRootKey()
 {
     RegistryKey rootKey = this.GetTestRegistryKey();
     var options = new TestableT4ToolboxOptions(() => rootKey);
     options.LoadSettingsFromStorage();
     rootKey.GetValueNames(); // ObjectDisposedException here
 }
Exemplo n.º 9
0
 public void LoadSettingsFromStorageDoesNotChangePropertiesWhenRegistryKeyDoesNotExist()
 {
     var options = new TestableT4ToolboxOptions(this.GetTestRegistryKey);
     options.LoadSettingsFromStorage();
     Assert.IsTrue(options.SyntaxColorizationEnabled);
 }
Exemplo n.º 10
0
 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);
     }
 }
Exemplo n.º 11
0
 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);
     }
 }
Exemplo n.º 12
0
 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);
     }
 }