public CorkboardController(CorkboardViewModel viewModel, CorkboardSettingsViewModel settingsViewModel, IRepository<RetrospectiveNote> retrospectiveNoteRepository, IPersistDomainModelsAsync<RetrospectiveNote> persistRetrospectiveNoteRepository, IDeleteDomainModelsAsync<RetrospectiveNote> deleteRetrospectiveNoteRepository, ITimer timer, IUIInvoker uiInvoker, IInvokeBackgroundWorker asyncClient, ILog logger, IProgressbar progressbar, Configuration config ) { _viewModel = viewModel; _settingsViewModel = settingsViewModel; _asyncClient = asyncClient; _repository = retrospectiveNoteRepository; _persistRepository = persistRetrospectiveNoteRepository; _uiInvoker = uiInvoker; _refreshNotifier = timer; _logger = logger; _progressBar = progressbar; _currentConfig = config; _deleteRepository = deleteRetrospectiveNoteRepository; _persistRepository.SaveCompleted += PersisterSaveCompleted; _refreshNotifier.Elapsed += (o, e) => UpdateViewModels(); _settingsViewModel.Save.ExecuteDelegate = Save; _settingsViewModel.ReloadSettings.ExecuteDelegate = ReloadSettings; UpdateViewModels(); }
public WorkingDaysLeftController( WorkingDaysLeftViewModel leftViewModel, WorkingDaysLeftSettingsViewModel settingsViewModel, IAsyncRepository<ProjectInfoServer> projectInforepository, IAsyncRepository<Holiday> holidayRepository, ITimer refreshNotifier, ILog logger, IProgressbar loadingNotifier, Configuration config) { this.leftViewModel = leftViewModel; this.settingsViewModel = settingsViewModel; this.holidayRepository = holidayRepository; this.projectInforepository = projectInforepository; this.logger = logger; this.loadingNotifier = loadingNotifier; this.refreshNotifier = refreshNotifier; this.Rand = new Random((int)DateTime.Now.Ticks).Next(); projectInforepository.GetCompleted += GotProjectInfo; holidayRepository.GetCompleted += GotHolidays; this.settingsViewModel.RefreshAvailableServers.ExecuteDelegate = OnRefreshAvailableServers; this.settingsViewModel.ReloadSettings.ExecuteDelegate = settingsViewModel.Reset; refreshNotifier.Elapsed += refreshNotifier_Elapsed; settingsViewModel.PropertyChanged += RefreshAvailableProjectsWhenSelectedServerChanges; refreshNotifier.Start(10000); OnRefreshAvailableServers(); SetConfigAndUpdate(config); }
public static Configuration GetDefaultConfiguration() { var config = new Configuration("webpage"); config.NewSetting(url, ""); config.NewSetting(refresh_interval, "30"); return config; }
public GraphSettingsController(GraphSettings graphSettingsViewModel, GraphController graphController, Configuration configuration, IDownloadStringService downloadStringService, IPersistDomainModels<Configuration> configRepository) { Guard.Requires<ArgumentNullException>(graphSettingsViewModel != null); Guard.Requires<ArgumentNullException>(graphController != null); Guard.Requires<ArgumentNullException>(configuration != null); Guard.Requires<ArgumentNullException>(downloadStringService != null); Guard.Requires<ArgumentNullException>(configRepository != null); this.graphController = graphController; GraphSettingsViewModel = graphSettingsViewModel; GraphSettingsViewModel.Graph = GraphViewModel; GraphSettingsViewModel.PropertyChanged += ViewModel_PropertyChanged; GraphSettingsViewModel.Save.AfterExecute += ViewModel_Save_AfterExecute; GraphSettingsViewModel.Test.AfterExecute += ViewModel_Test_AfterExecute; graphSettingsViewModel.Cancel.AfterExecute += ViewModel_Cancel_AfterExecute; this.downloadStringService = downloadStringService; this.configRepository = configRepository; graphConfig = new GraphConfig(configuration); backupConfig = new GraphConfig(configuration.Clone() as Configuration); DownloadAndLoadDataIntoViewModel(); }
protected override void before() { newConfig = new Configuration("new config"); oldConfigId = widgetToReturnConfigurationFrom.Configuration.Id; repo.SaveCompleted += (o, e) => { saveCompletedWasFired = true; }; repo.Save(newConfig); }
public void Then_assure_Configuration_contains_Database_setting() { configuration = new Configuration(); configuration.NewSetting(GraphConfig.refrehInterval_setting_name, "0"); this.ShouldThrowException<ArgumentException>(() => NewController()); }
private void CheckForChangesAndNotify(Configuration latestConfig, Widget registeredWidget) { if( latestConfig != null ) { if( !ConfigsAreEqual(latestConfig, registeredWidget.Configuration)) { registeredWidget.Configuration = latestConfig; } } }
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 Then_assure_Configuration_contains_XAxisPropertyName() { configuration = new Configuration(); configuration.NewSetting(GraphConfig.refrehInterval_setting_name, "5"); configuration.NewSetting(GraphConfig.database_setting_name); configuration.NewSetting(GraphConfig.collection_setting_name); this.ShouldThrowException<ArgumentException>(() => NewController(), ex => ex.Message.ShouldBe("Config setting is missing; " + GraphConfig.xaxis_property_setting_name)); }
public static List<Configuration> CreateConfiguration(bool isManuallyConfigured, DateTime endDate) { var _configuration = new Configuration("project-info"); _configuration.NewSetting(WorkingDaysLeftController.SETTING_IS_MANUALLY_CONFIGURED, isManuallyConfigured ? "true" : "false"); _configuration.NewSetting(WorkingDaysLeftController.SETTING_END_DATE, endDate.ToString(CultureInfo.InvariantCulture)); _configuration.NewSetting(WorkingDaysLeftController.SETTING_SERVER, SERVER_NAME); _configuration.NewSetting(WorkingDaysLeftController.SETTING_PROJECT, PROJECT_NAME); _configuration.NewSetting(WorkingDaysLeftController.SETTING_NON_WORK_DAYS, "Saturday", "Sunday"); return new List<Configuration> { _configuration }; }
private void MockRepository() { var config = new Configuration("Commit Statistics"); config.NewSetting("timespan", "4"); var fakeConfig = new List<Configuration> { config }; configRepository = new Mock<IAsyncRepository<Configuration>>(); configRepository.Setup( r => r.BeginGet(It.IsAny<Specification<Configuration>>())).Raises( t => t.GetCompleted += null, new GetCompletedEventArgs<Configuration>(fakeConfig, null)); }
public WebPageController(WebPageViewModel webPageViewModel, Configuration configuration, ITimer timer) { Guard.Requires<ArgumentNullException>(webPageViewModel != null); Guard.Requires<ArgumentNullException>(configuration != null); Guard.Requires<ArgumentNullException>(timer != null); this.config = configuration; this.webPageViewModel = webPageViewModel; webPageViewModel.PropertyChanged += webPageViewModel_PropertyChanged; webPageViewModel.ReloadSettings.ExecuteDelegate = () => UpdateConfiguration(config); this.timer = timer; timer.Elapsed += new EventHandler(timer_Elapsed); ConfigureAndStartTimer(); UpdateConfiguration(configuration); }
protected void AssertAreEqual(Configuration result, Configuration expected) { result.Id.ShouldBe(expected.Id); result.Name.ShouldBe(expected.Name); result.Settings.Count().ShouldBe(expected.Settings.Count()); result.IsConfigured.ShouldBe(expected.IsConfigured); for (int i = 0; i < result.Settings.Count(); i++) { result.Settings.ElementAt(i).Value.ShouldBe(expected.Settings.ElementAt(i).Value); result.Settings.ElementAt(i).Name.ShouldBe(expected.Settings.ElementAt(i).Name); result.Settings.ElementAt(i).Vals.Count().ShouldBe(expected.Settings.ElementAt(i).Vals.Count()); for (int j = 0; j < result.Settings.ElementAt(i).Vals.Count(); j++) { result.Settings.ElementAt(i).Vals.ElementAt(j).ShouldBe(expected.Settings.ElementAt(i).Vals.ElementAt(j)); } } }
private bool ConfigsAreEqual(Configuration result, Configuration expected) { bool areEqual = result.Id.Equals(expected.Id); areEqual &= result.Name.Equals(expected.Name); areEqual &= result.Settings.Count().Equals(expected.Settings.Count()); if (areEqual == false) return false; for (int i = 0; i < result.Settings.Count(); i++) { areEqual &= result.Settings.ElementAt(i).Value == expected.Settings.ElementAt(i).Value; areEqual &= result.Settings.ElementAt(i).Name.Equals(expected.Settings.ElementAt(i).Name); areEqual &= result.Settings.ElementAt(i).Vals.Count().Equals(expected.Settings.ElementAt(i).Vals.Count()); if (areEqual == false) return false; for (int j = 0; j < result.Settings.ElementAt(i).Vals.Count(); j++) { areEqual &= result.Settings.ElementAt(i).Vals.ElementAt(j).Equals(expected.Settings.ElementAt(i).Vals.ElementAt(j)); } } return areEqual; }
public void Setup() { configuration = new Configuration("source control"); configuration.Id = Guid.NewGuid(); copy = configuration.Clone(); }
public void Assure_it_has_a_constructor_without_args() { //This is for Serialization purposes var newConfig = new Configuration(); }
public void Assure_value_is_changed() { var configuration = new Configuration(); configuration.NewSetting("hello", "world"); configuration.ChangeSetting("hello", "moon"); configuration.GetSetting("hello").Value.ShouldBe("moon"); }
public void Setup() { configuration = new Configuration("source control"); configuration.NewSetting("username", "goeran"); }
public void Assure_its_possible_to_check_if_setting_exist_when_there_are_no_settings() { configuration = new Configuration("new config"); configuration.ContainsSetting("does not exist").ShouldBeFalse(); }
public void Setup() { configuration = new Configuration(); }
public void Setup() { configuration = new Configuration("source control"); configuration.NewSetting("provider", "svn"); }
public void Setup() { configuration = new Configuration("source control"); configuration.NewSetting("supported providers", "svn", "tfs", "clear case"); configuration.NewSetting("selected provider", "svn"); }
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); } }
private void LoadConfig() { SetIsLoadingConfig(); asyncClient.RunAsyncVoid(() => { try { var allConfigSpec = new ConfigurationByName(SETTINGS_ENTRY_NAME); currentConfiguration = configRepository .Get(allConfigSpec) .SingleOrDefault(); LoadSettings(currentConfiguration); } catch (Exception exception) { LogError(exception); } }); SetIsNotLoadingConfig(); }
public void Assure_new_Id_is_created() { var config = new Configuration(); config.Id.ShouldNotBe(Guid.Empty); }
public void Setup() { configuration = new Configuration("source control"); configuration.Id = Guid.NewGuid(); configuration.NewSetting("supported providers", "svn", "tfs", "clear case"); configuration.NewSetting("selected provider", "svn"); configuration.IsConfigured = true; copy = configuration.Clone(); }
public void Assure_Name_parameter_is_set_as_corresponding_Value() { var config = new Configuration("source control"); config.Name.ShouldBe("source control"); }
public void Setup() { graphSettingsViewModel = new GraphSettings(); downloadStringServiceFake = new Mock<IDownloadStringService>(); configRepositoryFake = new Mock<IPersistDomainModels<Configuration>>(); configuration = GraphConfig.NewDefaultConfiguration(); graphController = new Mock<GraphController>( new Graph(), downloadStringServiceFake.Object, new Mock<ITimer>().Object, configuration, new Mock<IProgressbar>().Object); Before(); }
public void Setup() { configuration = new Configuration("source control"); }
private static Configuration CreateConfiguration(bool firstName, bool surname, bool middlename, bool username, string userdbName) { var newConfig = new Configuration(SETTINGS_ENTRY_NAME); newConfig.NewSetting(FIRSTNAME_ENTRY_NAME, firstName.ToString()); newConfig.NewSetting(SURNAME_ENTRY_NAME, surname.ToString()); newConfig.NewSetting(MIDDLENAME_ENTRY_NAME, middlename.ToString()); newConfig.NewSetting(USERNAME_ENTRY_NAME, username.ToString()); newConfig.NewSetting(SELECTED_USERDB_ENTRY_NAME, userdbName); return newConfig; }