From e3e6b23b7c6ba1803bb601b4b41f22f8b0bf56e6 Mon Sep 17 00:00:00 2001 From: Yevhenii Holovachov <55396981+yevhenii44@users.noreply.github.com> Date: Wed, 8 Jul 2020 18:00:44 +0300 Subject: [PATCH] fixed unit tests (#4865) --- .../ViewModels/FancyZonesViewModel.cs | 9 ++++++--- .../ViewModelTests/FancyZones.cs | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs index 4c821a8c2c..1c64d1b0b1 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs @@ -465,9 +465,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public void RaisePropertyChanged([CallerMemberName] string propertyName = null) { OnPropertyChanged(propertyName); - SndFancyZonesSettings outsettings = new SndFancyZonesSettings(Settings); - SndModuleSettings ipcMessage = new SndModuleSettings(outsettings); - ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString()); + if (ShellPage.DefaultSndMSGCallback != null) + { + SndFancyZonesSettings outsettings = new SndFancyZonesSettings(Settings); + SndModuleSettings ipcMessage = new SndModuleSettings(outsettings); + ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString()); + } } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/FancyZones.cs b/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/FancyZones.cs index f5f3b4b4d3..45e8f2b092 100644 --- a/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/FancyZones.cs +++ b/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/FancyZones.cs @@ -43,6 +43,8 @@ namespace ViewModelTests { DeleteFolder(ModuleName); } + + ShellPage.DefaultSndMSGCallback = null; } public void DeleteFolder(string powertoy)