public void UpdateConfiguration(Configuration config) { Guard.Requires<ArgumentNullException>(config != null); Guard.Requires<ArgumentException>(config.ContainsSetting(url)); Guard.Requires<ArgumentException>(config.ContainsSetting(refresh_interval)); this.config = config; webPageViewModel.InputUrl = config.GetSetting(url).Value; webPageViewModel.ValidatedUrl = config.GetSetting(url).Value; webPageViewModel.RefreshInterval = int.Parse(config.GetSetting(refresh_interval).Value); }
public void Assure_value_is_changed() { var configuration = new Configuration(); configuration.NewSetting("hello", "world"); configuration.ChangeSetting("hello", "moon"); configuration.GetSetting("hello").Value.ShouldBe("moon"); }
private void LoadSettings(Configuration config) { if (config != null && config.Settings.Count() != 0) { TryLoadSpecificSetting(config.GetSetting(FIRSTNAME_ENTRY_NAME)); TryLoadSpecificSetting(config.GetSetting(SURNAME_ENTRY_NAME)); TryLoadSpecificSetting(config.GetSetting(MIDDLENAME_ENTRY_NAME)); TryLoadSpecificSetting(config.GetSetting(USERNAME_ENTRY_NAME)); } else { configPersisterRepository.Save(DefaultConfig); LoadSettings(DefaultConfig); } }
public ProjectConfigViewModel(CIProject project, Configuration config) { this.Project = project; this.SelectedSetting = config.GetSetting(CISettingsViewModel.GetProjectSelectedSettingName(project)); this.initialSelectedState = Boolean.Parse(SelectedSetting.Value); }
protected void AssertConfigurationIsCorrect(Configuration config) { Assert.IsTrue(config.IsConfigured); Assert.AreEqual(TwitterController.TWITTER_CONFIG_NAME, config.Name); Assert.AreEqual(_guid.ToString(), config.GetSetting(TwitterController.SETTING_SEARCH_STRING).Value); Assert.AreEqual(_guid.ToString().GetHashCode(), int.Parse(config.GetSetting(TwitterController.SETTING_MAX_NUMBER_OF_TWEETS).Value)); Assert.AreEqual(_guid.ToString().GetHashCode(), int.Parse(config.GetSetting(TwitterController.SETTING_REFRESH_INTERVAL_SECONDS).Value)); }
private void UpdateSettingsViewModelFromConfig(Configuration configuration) { _settingsViewModel.IsManuallyConfigured = bool.Parse(configuration.GetSetting(SETTING_USE_CONFIG_END_DATE).Value); _settingsViewModel.SelectedServer = configuration.GetSetting(SETTING_SERVER).Value; _settingsViewModel.SelectedProject = configuration.GetSetting(SETTING_PROJECT).Value; if (_settingsViewModel.IsManuallyConfigured) _settingsViewModel.SelectedEndDate = DateTime.Parse(configuration.GetSetting(SETTING_END_DATE).Value, CultureInfo.InvariantCulture); foreach (string nonWorkingDay in configuration.GetSetting(SETTING_NON_WORK_DAYS).Vals) { var dayFromSetting = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), nonWorkingDay, true); _settingsViewModel.NonWorkWeekDays.First(d => d.Day == dayFromSetting).IsNotWorkingDay = true; } }
private void GetEndDateFromConfig(Configuration config) { _endDateToUse = DateTime.Parse(config.GetSetting(SETTING_END_DATE).Value, CultureInfo.InvariantCulture); }