public void IsLightThemeRadioButtonChecked_ShouldThemeToLight_WhenSuccessful() { // Arrange GeneralViewModel viewModel = null; // Assert Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.AreEqual("light", snd.GeneralSettings.Theme); return(0); }; Func <string, int> SendRestartAdminIPCMessage = msg => { return(0); }; Func <string, int> SendCheckForUpdatesIPCMessage = msg => { return(0); }; viewModel = new GeneralViewModel( "GeneralSettings_RunningAsAdminText", "GeneralSettings_RunningAsUserText", false, false, UpdateUIThemeMethod, SendMockIPCConfigMSG, SendRestartAdminIPCMessage, SendCheckForUpdatesIPCMessage, generalSettings_file_name); Assert.IsFalse(viewModel.IsLightThemeRadioButtonChecked); // act viewModel.IsLightThemeRadioButtonChecked = true; }
public void Startup_ShouldEnableRunOnStartUp_WhenSuccessful() { // Assert Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Startup); return(0); }; // Arrange Func <string, int> SendRestartAdminIPCMessage = msg => { return(0); }; Func <string, int> SendCheckForUpdatesIPCMessage = msg => { return(0); }; GeneralViewModel viewModel = new GeneralViewModel( "GeneralSettings_RunningAsAdminText", "GeneralSettings_RunningAsUserText", false, false, UpdateUIThemeMethod, SendMockIPCConfigMSG, SendRestartAdminIPCMessage, SendCheckForUpdatesIPCMessage, generalSettings_file_name); Assert.IsFalse(viewModel.Startup); // act viewModel.Startup = true; }
private int ColorPickerIsEnabledByDefault_IPC(string msg) { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.ColorPicker); return(0); }
public void IsLightThemeRadioButtonCheckedShouldThemeToLightWhenSuccessful() { // Arrange GeneralViewModel viewModel = null; // Assert Func <string, int> sendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.AreEqual("light", snd.GeneralSettings.Theme); return(0); }; Func <string, int> sendRestartAdminIPCMessage = msg => { return(0); }; Func <string, int> sendCheckForUpdatesIPCMessage = msg => { return(0); }; viewModel = new GeneralViewModel( settingsRepository: SettingsRepository <GeneralSettings> .GetInstance(mockGeneralSettingsUtils.Object), "GeneralSettings_RunningAsAdminText", "GeneralSettings_RunningAsUserText", false, false, UpdateUIThemeMethod, sendMockIPCConfigMSG, sendRestartAdminIPCMessage, sendCheckForUpdatesIPCMessage, GeneralSettingsFileName); Assert.AreNotEqual(1, viewModel.ThemeIndex); // act viewModel.ThemeIndex = 1; }
public void IsDarkThemeRadioButtonCheckedShouldThemeToDarkWhenSuccessful() { // Arrange // Assert Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.AreEqual("dark", snd.GeneralSettings.Theme); return(0); }; Func <string, int> SendRestartAdminIPCMessage = msg => { return(0); }; Func <string, int> SendCheckForUpdatesIPCMessage = msg => { return(0); }; GeneralViewModel viewModel = new GeneralViewModel( SettingsRepository <GeneralSettings> .GetInstance(mockGeneralSettingsUtils.Object), "GeneralSettings_RunningAsAdminText", "GeneralSettings_RunningAsUserText", false, false, UpdateUIThemeMethod, SendMockIPCConfigMSG, SendRestartAdminIPCMessage, SendCheckForUpdatesIPCMessage, generalSettingsFileName); Assert.IsFalse(viewModel.IsDarkThemeRadioButtonChecked); // act viewModel.IsDarkThemeRadioButtonChecked = true; }
public void RunElevatedShouldEnableAlwaysRunElevatedWhenSuccessful() { // Assert Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.RunElevated); return(0); }; Func <string, int> SendRestartAdminIPCMessage = msg => { return(0); }; Func <string, int> SendCheckForUpdatesIPCMessage = msg => { return(0); }; // Arrange GeneralViewModel viewModel = new GeneralViewModel( SettingsRepository <GeneralSettings> .GetInstance(mockGeneralSettingsUtils.Object), "GeneralSettings_RunningAsAdminText", "GeneralSettings_RunningAsUserText", false, false, UpdateUIThemeMethod, SendMockIPCConfigMSG, SendRestartAdminIPCMessage, SendCheckForUpdatesIPCMessage, generalSettingsFileName); Assert.IsFalse(viewModel.RunElevated); // act viewModel.RunElevated = true; }
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null) { // Notify UI of property change OnPropertyChanged(propertyName); OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(GeneralSettingsConfig); SendConfigMSG(outsettings.ToString()); }
public void RaisePropertyChanged([CallerMemberName] string propertyName = null) { // Notify UI of property change OnPropertyChanged(propertyName); OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(GeneralSettingsConfigs); ShellPage.DefaultSndMSGCallback(outsettings.ToString()); }
// callback function to launch the URL to check for updates. private void CheckForUpdatesClick() { GeneralSettingsConfig.CustomActionName = "check_for_updates"; OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(GeneralSettingsConfig); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); SendCheckForUpdatesConfigMSG(customaction.ToString()); }
public void RestartElevated() { GeneralSettingsConfig.CustomActionName = "restart_elevation"; OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(GeneralSettingsConfig); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); SendRestartAsAdminConfigMSG(customaction.ToString()); }
public void RequestUpdateCheckedDate() { GeneralSettingsConfig.CustomActionName = "request_update_state_date"; OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(GeneralSettingsConfig); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); SendCheckForUpdatesConfigMSG(customaction.ToString()); }
public void Restart_Elevated() { GeneralSettings settings = _settingsUtils.GetSettings <GeneralSettings>(_settingsConfigFileFolder); settings.CustomActionName = "restart_elevation"; OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); SendRestartAsAdminConfigMSG(customaction.ToString()); }
// callback function to launch the URL to check for updates. private void CheckForUpdates_Click() { GeneralSettings settings = _settingsUtils.GetSettings <GeneralSettings>(_settingsConfigFileFolder); settings.CustomActionName = "check_for_updates"; OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); SendCheckForUpdatesConfigMSG(customaction.ToString()); }
public void Restart_Elevated() { GeneralSettings settings = SettingsUtils.GetSettings <GeneralSettings>(string.Empty); settings.CustomActionName = "restart_elevation"; OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); ShellPage.SndRestartAsAdminMsgCallback?.Invoke(customaction.ToString()); }
// callback function to launch the URL to check for updates. private void CheckForUpdates_Click() { GeneralSettings settings = SettingsUtils.GetSettings <GeneralSettings>(string.Empty); settings.CustomActionName = "check_for_updates"; OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); ShellPage.CheckForUpdatesMsgCallback?.Invoke(customaction.ToString()); }
public void ColorPickerIsEnabledByDefault() { var viewModel = new ColorPickerViewModel(); ShellPage.DefaultSndMSGCallback = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.ColorPicker); }; Assert.IsTrue(viewModel.IsEnabled); }
public void IsEnabled_ShouldEnableModule_WhenSuccessful() { // arrange ImageResizerViewModel viewModel = new ImageResizerViewModel(); // Assert ShellPage.DefaultSndMSGCallback = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.ImageResizer); }; // act viewModel.IsEnabled = true; }
public void IsEnabledShouldEnableModuleWhenSuccessful() { // Assert Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.ImageResizer); return(0); }; // arrange ImageResizerViewModel viewModel = new ImageResizerViewModel(mockImgResizerSettingsUtils.Object, SettingsRepository <GeneralSettings> .GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG); // act viewModel.IsEnabled = true; }
public void IsEnabled_ShouldEnableModule_WhenSuccessful() { // Arrange ShortcutGuideViewModel viewModel = new ShortcutGuideViewModel(); // Assert // Initialize mock function of sending IPC message. ShellPage.DefaultSndMSGCallback = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.ShortcutGuide); }; // Act viewModel.IsEnabled = true; }
public void IsEnabledShouldEnableModuleWhenSuccessful() { // Assert Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.PowerRename); return(0); }; // arrange PowerRenameViewModel viewModel = new PowerRenameViewModel(mockPowerRenamePropertiesUtils.Object, SettingsRepository <GeneralSettings> .GetInstance(mockGeneralSettingsUtils.Object), SendMockIPCConfigMSG, generalSettingsFileName); // act viewModel.IsEnabled = true; }
public void IsEnabled_ShouldEnableModule_WhenSuccessful() { // Assert Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.PowerRename); return(0); }; // arrange PowerRenameViewModel viewModel = new PowerRenameViewModel(ISettingsUtilsMocks.GetStubSettingsUtils().Object, SendMockIPCConfigMSG, generalSettings_file_name); // act viewModel.IsEnabled = true; }
public void IsEnabled_ShouldDisableModule_WhenSuccessful() { // arrange FancyZonesViewModel viewModel = new FancyZonesViewModel(); Assert.IsTrue(viewModel.IsEnabled); // check if the module is enabled. // Assert ShellPage.DefaultSndMSGCallback = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg); Assert.IsFalse(snd.GeneralSettings.Enabled.FancyZones); }; // act viewModel.IsEnabled = false; }
public void IsEnabled_ShouldEnableModule_WhenSuccessful() { // Assert Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.ImageResizer); return(0); }; // arrange ImageResizerViewModel viewModel = new ImageResizerViewModel(SendMockIPCConfigMSG); // act viewModel.IsEnabled = true; }
public void IsEnabledShouldDisableModuleWhenSuccessful() { Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsFalse(snd.GeneralSettings.Enabled.FancyZones); return(0); }; // arrange FancyZonesViewModel viewModel = new FancyZonesViewModel(SettingsRepository <GeneralSettings> .GetInstance(mockGeneralSettingsUtils.Object), SettingsRepository <FancyZonesSettings> .GetInstance(mockFancyZonesSettingsUtils.Object), SendMockIPCConfigMSG, FancyZonesTestFolderName); Assert.IsTrue(viewModel.IsEnabled); // check if the module is enabled. // act viewModel.IsEnabled = false; }
public void RunElevated_ShouldEnableAlwaysRunElevated_WhenSuccessful() { // Arrange GeneralViewModel viewModel = new GeneralViewModel(); Assert.IsFalse(viewModel.RunElevated); // Assert ShellPage.DefaultSndMSGCallback = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.RunElevated); }; // act viewModel.RunElevated = true; }
public void Startup_ShouldEnableRunOnStartUp_WhenSuccessful() { // Arrange GeneralViewModel viewModel = new GeneralViewModel(); Assert.IsFalse(viewModel.Startup); // Assert ShellPage.DefaultSndMSGCallback = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Startup); }; // act viewModel.Startup = true; }
public void IsDarkThemeRadioButtonChecked_ShouldThemeToDark_WhenSuccessful() { // Arrange GeneralViewModel viewModel = new GeneralViewModel(); Assert.IsFalse(viewModel.IsDarkThemeRadioButtonChecked); // Assert ShellPage.DefaultSndMSGCallback = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.AreEqual("dark", snd.GeneralSettings.Theme); }; // act viewModel.IsDarkThemeRadioButtonChecked = true; }
public void AutoDownloadUpdates_ShouldEnableAutoDownloadUpdates_WhenSuccessful() { // Arrange GeneralViewModel viewModel = new GeneralViewModel(); Assert.IsFalse(viewModel.AutoDownloadUpdates); // Assert ShellPage.DefaultSndMSGCallback = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.AutoDownloadUpdates); }; // act viewModel.AutoDownloadUpdates = true; }
public void IsEnabled_ShouldEnableModule_WhenSuccessful() { // Assert // Initialize mock function of sending IPC message. Func <string, int> SendMockIPCConfigMSG = msg => { OutGoingGeneralSettings snd = JsonSerializer.Deserialize <OutGoingGeneralSettings>(msg); Assert.IsTrue(snd.GeneralSettings.Enabled.ShortcutGuide); return(0); }; // Arrange ShortcutGuideViewModel viewModel = new ShortcutGuideViewModel(SettingsRepository <GeneralSettings> .GetInstance(mockGeneralSettingsUtils.Object), SettingsRepository <ShortcutGuideSettings> .GetInstance(mockShortcutGuideSettingsUtils.Object), SendMockIPCConfigMSG, ShortCutGuideTestFolderName); // Act viewModel.IsEnabled = true; }
// callback function to launch the URL to check for updates. private void CheckForUpdatesClick() { IsNewVersionDownloading = string.IsNullOrEmpty(UpdatingSettingsConfig.DownloadedInstallerFilename); NotifyPropertyChanged(nameof(IsDownloadAllowed)); if (_isNewVersionChecked) { _isNewVersionChecked = !IsNewVersionDownloading; NotifyPropertyChanged(nameof(IsNewVersionCheckedAndUpToDate)); } GeneralSettingsConfig.CustomActionName = "check_for_updates"; OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(GeneralSettingsConfig); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); SendCheckForUpdatesConfigMSG(customaction.ToString()); }