private void LoadColrAndThemeFromSettings()
        {
            // get from config object the settings fro Coloer and Theme
            string colorSetting = _userConfigService.GetConfigItemValue(Color_Config_Key);
            string themeSetting = _userConfigService.GetConfigItemValue(Theme_Config_Key);

            // If found, convert to accent color and theme data
            if (colorSetting != String.Empty && themeSetting != String.Empty)
            {
                // Look AccentColor and theme in the available list, save it
                _selectedAccentColorData = _accentColorDataList.FirstOrDefault(a => a.Name == colorSetting);
                // Look Theme Data in the available list, and apply it
                _SelectedAppThemeData = _appThemeDataList.FirstOrDefault(t => t.Name == themeSetting);
            }
        }
示例#2
0
        public void GetConfigItemValueTest()
        {
            // Arrange
            string configKey   = "Color";
            string configValue = "Orange";

            // Act
            string configValue2 = _serviceMockObject.GetConfigItemValue(configKey);

            // Assert
            Assert.AreEqual(configValue, configValue2);
        }
        public void GetAndSetConfigItemValueTest()
        {
            // NOTE: The Moq repository object does no have the functinality
            //       to set or get a config item. However, the DI container
            //       can resolve the functionality. Therefore, in this test
            //       method, both functions are tested, adding first the item
            //       and then getting it.

            // Arrange
            string configKey   = "Color";
            string configValue = "Orange";

            // Act
            bool success = _userConfigService.SetConfigItem(configKey, configValue);

            // Assert
            Assert.IsTrue(success);

            // Act
            string configValue2 = _userConfigService.GetConfigItemValue(configKey);

            // Assert
            Assert.AreEqual(configValue, configValue2);
        }