From c48bd9b8407bba6fadd62e03818ab2cedd424f3e Mon Sep 17 00:00:00 2001 From: ryanbodrug-microsoft <56318517+ryanbodrug-microsoft@users.noreply.github.com> Date: Thu, 30 Jul 2020 15:58:01 -0700 Subject: [PATCH] User/ryanbod/fix unittests (#5191) * Fixing PowerLauncherViewModelTest.cs. These OpenConsole functionality was accidentlly removed in a merge conflict, which broke the build. The build was fixed, but the unit tests didn't work. https://github.com/microsoft/PowerToys/commit/034079b4413a051415a547d238affe674179df01 is the offending change. * Color picker tests need to remove the ShellPage.DefaultSndMSGCallback on cleanup. * Fixing casing that was updated in previous change. --- .../ViewModels/PowerLauncherViewModel.cs | 17 +++++++++++++++++ .../ViewModelTests/ColorPicker.cs | 2 ++ .../PowerLauncherViewModelTest.cs | 1 + 3 files changed, 20 insertions(+) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs index 71ed10041a..afd25532f6 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs @@ -168,6 +168,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels } } + public HotkeySettings OpenConsole + { + get + { + return settings.Properties.OpenConsole; + } + + set + { + if (settings.Properties.OpenConsole != value) + { + settings.Properties.OpenConsole = value; + UpdateSettings(); + } + } + } + public HotkeySettings CopyPathLocation { get diff --git a/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/ColorPicker.cs b/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/ColorPicker.cs index 63fd7da24e..09d47f81c0 100644 --- a/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/ColorPicker.cs +++ b/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/ColorPicker.cs @@ -35,6 +35,8 @@ namespace ViewModelTests { DeleteFolder(ModuleName); } + + ShellPage.DefaultSndMSGCallback = null; } [TestMethod] diff --git a/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/PowerLauncherViewModelTest.cs b/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/PowerLauncherViewModelTest.cs index 7cab1c63ec..6727062fa5 100644 --- a/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/PowerLauncherViewModelTest.cs +++ b/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/PowerLauncherViewModelTest.cs @@ -80,6 +80,7 @@ namespace ViewModelTests viewModel.OpenPowerLauncher = openPowerLauncher; viewModel.OpenFileLocation = openFileLocation; + viewModel.OpenConsole = openConsole; viewModel.CopyPathLocation = copyFileLocation; Assert.AreEqual(4, sendCallbackMock.TimesSent);