コード例 #1
0
        public void SetConfigItem()
        {
            // Arrange
            string configKey   = "Color";
            string configValue = "Orange";

            // Act
            bool succes = _serviceMockObject.SetConfigItem(configKey, configValue);

            // Assert
            Assert.IsTrue(succes);
        }
コード例 #2
0
        private void SaveSettings(object obj)
        {
            // Apply color and theme
            ApplyAccentColor(_selectedAccentColorData);
            ApplyAppTheme(_SelectedAppThemeData);

            // SAVE: set color and theme in config file, and save the file
            _userConfigService.SetConfigItem(Color_Config_Key, _selectedAccentColorData.Name);
            _userConfigService.SetConfigItem(Theme_Config_Key, _SelectedAppThemeData.Name);
            _userConfigService.SaveUserConfiguration();

            // Prepare message for parent window
            var settingMsg = new SettingMessage()
            {
                IsOpen = false
            };

            // Send message
            // Note: For multi message, use context in order to have a unique identifier
            Messenger.Default.Send <SettingMessage>(settingMsg, Flyout_msg_key);
        }
コード例 #3
0
        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);
        }