[Settings] Adding Tests to Verify Backward Compatibility (#6161)

* compare config files

* create settings files

* updated path check

* reverted color picker changes

* added test files

* removed settings uralted files

* Modifying directory structure and adding properties for backcompat test.

* Updating Unit test to use mock repositories.
1) BackCompatTestProperties exposes mock repository implementation because SettingsRepository is a singleton, and settings utils isn't typed.
2) BackCompatTestProperties, encapsulates logic to verify that the correct file was read from.
3) Validating each file is read twice.  Once by the original file, and once via the view model.

* Adding 18.2 settings files.

* Fix compiler errors from latest merge

* Adding v0.19.2 test files.

* Adding in 0.20.1 settings.  Removing 0.20.2 (as this was a dev build number)

* Adding settings tests for 22.1

* General Settings should update version when they don't match

* Adding v0.22.0 files

* Removing not settings related files from TestData for PT Run 21.1

* Referencing module name as *Settings.ModuleName in tests.  Except for ImageResizer

* Using ImageResizerSettings to use Settings for the module name.

* Setting AllPlugins to empty list in case PluginManager.Save/Load/ReloadData is called before plugins are loaded

* Fixing fxcop errors

* using named parameters as per review feedback

Co-authored-by: ryanbodrug-microsoft <56318517+ryanbodrug-microsoft@users.noreply.github.com>
This commit is contained in:
Nkateko
2020-10-08 16:34:19 -07:00
committed by GitHub
parent 4451403c1e
commit 1390b57d3e
93 changed files with 1220 additions and 12 deletions

View File

@@ -98,7 +98,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
{
try
{
if (Helper.CompareVersions(PowertoysVersion, Helper.GetProductVersion()) < 0)
if (Helper.CompareVersions(PowertoysVersion, Helper.GetProductVersion()) != 0)
{
// Update settings
PowertoysVersion = Helper.GetProductVersion();

View File

@@ -10,7 +10,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class ImageResizerSettings : BasePTModuleSettings, ISettingsConfig
{
public const string ModuleName = "Image Resizer";
public const string ModuleName = "ImageResizer";
[JsonPropertyName("properties")]
public ImageResizerProperties Properties { get; set; }

View File

@@ -19,8 +19,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib.ViewModels
private ImageResizerSettings Settings { get; set; }
// NOTE: Not using ImageResizerSettings.ModuleName ("Image Resizer") to be backward compatible.
private const string ModuleName = "ImageResizer";
private const string ModuleName = ImageResizerSettings.ModuleName;
private Func<string, int> SendConfigMSG { get; }

View File

@@ -0,0 +1,87 @@
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.Interface;
using Microsoft.PowerToys.Settings.UI.Lib.Utilities;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Moq;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq.Expressions;
using System.Text;
namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility
{
public static class BackCompatTestProperties
{
public const string RootPathStubFiles = "..\\..\\..\\..\\src\\core\\Microsoft.PowerToys.Settings.UI.UnitTests\\BackwardsCompatibility\\TestFiles\\{0}\\Microsoft\\PowerToys\\{1}\\{2}";
internal class MockSettingsRepository<T> : ISettingsRepository<T> where T : ISettingsConfig, new()
{
T _settingsConfig;
readonly ISettingsUtils _settingsUtils;
public MockSettingsRepository( ISettingsUtils settingsUtils)
{
_settingsUtils = settingsUtils;
}
public T SettingsConfig
{
get
{
T settingsItem = new T();
_settingsConfig = _settingsUtils.GetSettings<T>(settingsItem.GetModuleName());
return _settingsConfig;
}
set
{
if (value != null)
{
_settingsConfig = value;
}
}
}
}
public static Mock<IIOProvider>GetModuleIOProvider(string version, string module, string fileName)
{
var stubSettingsPath = string.Format(CultureInfo.InvariantCulture, BackCompatTestProperties.RootPathStubFiles, version, module, fileName);
Expression<Func<string, bool>> filterExpression = (string s) => s.Contains(module, StringComparison.Ordinal);
var mockIOProvider = IIOProviderMocks.GetMockIOReadWithStubFile(stubSettingsPath, filterExpression);
return mockIOProvider;
}
public static void VerifyModuleIOProviderWasRead(Mock<IIOProvider> provider, string module, int expectedCallCount)
{
if(provider == null)
{
throw new ArgumentNullException(nameof(provider));
}
Expression<Func<string, bool>> filterExpression = (string s) => s.Contains(module, StringComparison.Ordinal);
IIOProviderMocks.VerifyIOReadWithStubFile(provider, filterExpression, expectedCallCount);
}
public static Mock<IIOProvider> GetGeneralSettingsIOProvider(string version)
{
var stubGeneralSettingsPath = string.Format(CultureInfo.InvariantCulture, BackCompatTestProperties.RootPathStubFiles, version, string.Empty, "settings.json");
Expression<Func<string, bool>> filterExpression = (string s) => s.Contains("Microsoft\\PowerToys\\settings.json", StringComparison.Ordinal);
var mockGeneralIOProvider = IIOProviderMocks.GetMockIOReadWithStubFile(stubGeneralSettingsPath, filterExpression);
return mockGeneralIOProvider;
}
public static void VerifyGeneralSettingsIOProviderWasRead(Mock<IIOProvider> provider, int expectedCallCount)
{
if (provider == null)
{
throw new ArgumentNullException(nameof(provider));
}
Expression<Func<string, bool>> filterExpression = (string s) => s.Contains("Microsoft\\PowerToys\\settings.json", StringComparison.Ordinal);
IIOProviderMocks.VerifyIOReadWithStubFile(provider, filterExpression, expectedCallCount);
}
}
}

View File

@@ -0,0 +1 @@
{"properties":{"ActivationShortcut":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":222,"key":""},"changecursor":{"value":false},"copiedcolorrepresentation":1},"name":"ColorPicker","version":"1.0"}

View File

@@ -0,0 +1 @@
{"version":"1.0","name":"FancyZones","properties":{"fancyzones_shiftDrag":{"value":false},"fancyzones_mouseSwitch":{"value":true},"fancyzones_overrideSnapHotkeys":{"value":true},"fancyzones_moveWindowAcrossMonitors":{"value":true},"fancyzones_moveWindowsBasedOnPosition":{"value":true},"fancyzones_displayChange_moveWindows":{"value":true},"fancyzones_zoneSetChange_moveWindows":{"value":true},"fancyzones_appLastZone_moveWindows":{"value":true},"fancyzones_openWindowOnActiveMonitor":{"value":true},"fancyzones_restoreSize":{"value":true},"use_cursorpos_editor_startupscreen":{"value":false},"fancyzones_show_on_all_monitors":{"value":true},"fancyzones_span_zones_across_monitors":{"value":true},"fancyzones_makeDraggedWindowTransparent":{"value":true},"fancyzones_zoneColor":{"value":"#B53AFF"},"fancyzones_zoneBorderColor":{"value":"#FF6508"},"fancyzones_zoneHighlightColor":{"value":"#9BD7D6"},"fancyzones_highlight_opacity":{"value":26},"fancyzones_editor_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":80,"key":""}},"fancyzones_excluded_apps":{"value":""}}}

View File

@@ -0,0 +1 @@
{"Properties":{"svg-previewer-toggle-setting":{"value":false},"svg-thumbnail-toggle-setting":{"value":false},"md-previewer-toggle-setting":{"value":false}},"name":"File Explorer","version":"1.0"}

View File

@@ -0,0 +1,92 @@
{
"properties": {
"imageresizer_selectedSizeIndex": {
"value": 0
},
"imageresizer_shrinkOnly": {
"value": false
},
"imageresizer_replace": {
"value": false
},
"imageresizer_ignoreOrientation": {
"value": true
},
"imageresizer_jpegQualityLevel": {
"value": 92
},
"imageresizer_pngInterlaceOption": {
"value": 1
},
"imageresizer_tiffCompressOption": {
"value": 4
},
"imageresizer_fileName": {
"value": "%1 (%2)"
},
"imageresizer_sizes": {
"value": [
{
"Id": 0,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Small",
"fit": 1,
"width": 853,
"height": 479,
"unit": 3
},
{
"Id": 1,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Medium",
"fit": 1,
"width": 1365,
"height": 767,
"unit": 3
},
{
"Id": 2,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Large",
"fit": 1,
"width": 1919,
"height": 1079,
"unit": 3
},
{
"Id": 3,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Phone",
"fit": 1,
"width": 319,
"height": 567,
"unit": 3
}
]
},
"imageresizer_keepDateModified": {
"value": true
},
"imageresizer_fallbackEncoder": {
"value": "163bcc30-e2e9-4f0b-961d-a3e9fdb788a3"
},
"imageresizer_customSize": {
"value": {
"Id": 4,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "custom",
"fit": 1,
"width": 1024,
"height": 640,
"unit": 3
}
}
},
"name": "Image Resizer",
"version": "1"
}

View File

@@ -0,0 +1,44 @@
{
"value": [
{
"Id": 0,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Small",
"fit": 1,
"width": 853,
"height": 479,
"unit": 3
},
{
"Id": 1,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Medium",
"fit": 1,
"width": 1365,
"height": 767,
"unit": 3
},
{
"Id": 2,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Large",
"fit": 1,
"width": 1919,
"height": 1079,
"unit": 3
},
{
"Id": 3,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Phone",
"fit": 1,
"width": 319,
"height": 567,
"unit": 3
}
]
}

View File

@@ -0,0 +1 @@
{"remapKeys":{"inProcess":[{"originalKeys":"83","newRemapKeys":"65"}]},"remapShortcuts":{"global":[{"originalKeys":"160;70","newRemapKeys":"160;20"}],"appSpecific":[]}}

View File

@@ -0,0 +1 @@
{"properties":{"activeConfiguration":{"value":"default"},"keyboardConfigurations":{"value":["default"]}},"name":"Keyboard Manager","version":"1"}

View File

@@ -0,0 +1 @@
{"Enabled":false,"ShowIcon":false,"ExtendedContextMenuOnly":true,"PersistState":false,"MRUEnabled":true,"MaxMRUSize":13,"SearchText":"","ReplaceText":""}

View File

@@ -0,0 +1 @@
{"properties":{"search_result_preference":"most_recently_used","search_type_preference":"application_name","maximum_number_of_results":8,"open_powerlauncher":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":186,"key":""},"open_file_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"copy_path_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"open_console":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"override_win_r_key":false,"override_win_s_key":false,"ignore_hotkeys_in_fullscreen":false,"disable_drive_detection_warning":true,"clear_input_on_launch":true},"name":"PowerToys Run","version":"1.0"}

View File

@@ -0,0 +1 @@
{"properties":{"overlay_opacity":{"value":36},"press_time":{"value":1050},"theme":{"value":"dark"}},"name":"Shortcut Guide","version":"1.0"}

View File

@@ -0,0 +1 @@
{"packaged":false,"startup":false,"enabled":{"ColorPicker":false,"FancyZones":false,"File Explorer":true,"Image Resizer":false,"Keyboard Manager":false,"PowerRename":false,"PowerToys Run":false,"Shortcut Guide":false},"is_elevated":false,"run_elevated":false,"download_updates_automatically":false,"is_admin":true,"theme":"light","system_theme":"dark","powertoys_version":"v0.21.1"}

View File

@@ -0,0 +1 @@
{"github_update_last_checked_date":"1601059000","pending_update":false,"pending_installer_filename":""}

View File

@@ -0,0 +1 @@
{"properties":{"ActivationShortcut":{"win":true,"ctrl":false,"alt":false,"shift":true,"code":67,"key":""},"changecursor":{"value":false},"copiedcolorrepresentation":0},"name":"ColorPicker","version":"1"}

View File

@@ -0,0 +1 @@
{"version":"1.0","name":"FancyZones","properties":{"fancyzones_shiftDrag":{"value":false},"fancyzones_mouseSwitch":{"value":true},"fancyzones_overrideSnapHotkeys":{"value":true},"fancyzones_moveWindowAcrossMonitors":{"value":true},"fancyzones_displayChange_moveWindows":{"value":true},"fancyzones_zoneSetChange_moveWindows":{"value":true},"fancyzones_virtualDesktopChange_moveWindows":{"value":true},"fancyzones_appLastZone_moveWindows":{"value":true},"use_cursorpos_editor_startupscreen":{"value":false},"fancyzones_show_on_all_monitors":{"value":true},"fancyzones_makeDraggedWindowTransparent":{"value":true},"fancyzones_zoneColor":{"value":"#F5FCFF"},"fancyzones_zoneBorderColor":{"value":"#365E5C"},"fancyzones_zoneHighlightColor":{"value":"#D77F70"},"fancyzones_highlight_opacity":{"value":93},"fancyzones_editor_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"key":"D","code":68}},"fancyzones_excluded_apps":{"value":""}}}

View File

@@ -0,0 +1 @@
{"app-zone-history":[],"devices":[{"device-id":"LEN4140#4&2cf01444&0&UID265988_1920_1200_{FAD9BC94-3335-41ED-A550-A14A1B4E2FB7}","active-zoneset":{"uuid":"{0C77400D-EBC4-40EB-A820-262706297DD0}","type":"priority-grid"},"editor-show-spacing":true,"editor-spacing":16,"editor-zone-count":3}],"custom-zone-sets":[]}

View File

@@ -0,0 +1 @@
{"properties":{"svg-previewer-toggle-setting":{"value":false},"md-previewer-toggle-setting":{"value":false}},"name":"File Explorer","version":"1.0"}

View File

@@ -0,0 +1,82 @@
{
"version": "1",
"name": "Image Resizer",
"properties": {
"imageresizer_selectedSizeIndex": {
"value": 0
},
"imageresizer_shrinkOnly": {
"value": false
},
"imageresizer_replace": {
"value": false
},
"imageresizer_ignoreOrientation": {
"value": true
},
"imageresizer_jpegQualityLevel": {
"value": 89
},
"imageresizer_pngInterlaceOption": {
"value": 2
},
"imageresizer_tiffCompressOption": {
"value": 2
},
"imageresizer_fileName": {
"value": "%1 (%2)"
},
"imageresizer_sizes": {
"value": [
{
"Id": 0,
"name": "Small",
"fit": 1,
"width": 1,
"height": 1,
"unit": 3
},
{
"Id": 1,
"name": "Medium",
"fit": 1,
"width": 1,
"height": 1,
"unit": 3
},
{
"Id": 2,
"name": "Large",
"fit": 1,
"width": 1,
"height": 1,
"unit": 3
},
{
"Id": 3,
"name": "Phone",
"fit": 1,
"width": 1,
"height": 1,
"unit": 3
}
]
},
"imageresizer_keepDateModified": {
"value": true
},
"imageresizer_fallbackEncoder": {
"value": "163bcc30-e2e9-4f0b-961d-a3e9fdb788a3"
},
"imageresizer_customSize": {
"value": {
"Id": 4,
"name": "custom",
"fit": 1,
"width": 1024,
"height": 640,
"unit": 3
}
}
}
}

View File

@@ -0,0 +1,36 @@
{
"value": [
{
"Id": 0,
"name": "Small",
"fit": 1,
"width": 1,
"height": 1,
"unit": 3
},
{
"Id": 1,
"name": "Medium",
"fit": 1,
"width": 1,
"height": 1,
"unit": 3
},
{
"Id": 2,
"name": "Large",
"fit": 1,
"width": 1,
"height": 1,
"unit": 3
},
{
"Id": 3,
"name": "Phone",
"fit": 1,
"width": 1,
"height": 1,
"unit": 3
}
]
}

View File

@@ -0,0 +1 @@
{"remapKeys":{"inProcess":[{"originalKeys":"65","newRemapKeys":"105"}]},"remapShortcuts":{"global":[{"originalKeys":"160;70","newRemapKeys":"160;82"}]}}

View File

@@ -0,0 +1 @@
{"properties":{"activeConfiguration":{"value":"default"},"keyboardConfigurations":{"value":["default"]}},"name":"Keyboard Manager","version":"1"}

View File

@@ -0,0 +1 @@
{"Enabled":false,"ShowIcon":false,"ExtendedContextMenuOnly":true,"PersistState":false,"MRUEnabled":true,"MaxMRUSize":8,"SearchText":"","ReplaceText":""}

View File

@@ -0,0 +1 @@
{"properties":{"search_result_preference":"most_recently_used","search_type_preference":"application_name","maximum_number_of_results":10,"open_powerlauncher":{"win":false,"ctrl":false,"alt":false,"shift":true,"key":"P","code":80},"open_file_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"key":"","code":0},"copy_path_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"key":"","code":0},"open_console":{"win":false,"ctrl":false,"alt":false,"shift":false,"key":"","code":0},"override_win_r_key":false,"override_win_s_key":false},"name":"PowerToys Run","version":"1.0"}

View File

@@ -0,0 +1 @@
{"name":"Shortcut Guide","properties":{"overlay_opacity":{"value":51},"press_time":{"value":100},"theme":{"value":"dark"}},"version":"1.0"}

View File

@@ -0,0 +1 @@
{"packaged":false,"startup":false,"enabled":{"FancyZones":false,"File Explorer":true,"Image Resizer":false,"Keyboard Manager":false,"PowerRename":false,"PowerToys Run":false,"Shortcut Guide":false},"is_elevated":false,"run_elevated":false,"download_updates_automatically":false,"is_admin":true,"theme":"dark","system_theme":"dark","powertoys_version":"v0.18.2"}

View File

@@ -0,0 +1 @@
{"github_update_last_checked_date":"1601047811","pending_update":false}

View File

@@ -0,0 +1 @@
{"version":"1.0","name":"FancyZones","properties":{"fancyzones_shiftDrag":{"value":true},"fancyzones_mouseSwitch":{"value":false},"fancyzones_overrideSnapHotkeys":{"value":false},"fancyzones_moveWindowAcrossMonitors":{"value":false},"fancyzones_displayChange_moveWindows":{"value":false},"fancyzones_zoneSetChange_moveWindows":{"value":false},"fancyzones_appLastZone_moveWindows":{"value":false},"use_cursorpos_editor_startupscreen":{"value":true},"fancyzones_show_on_all_monitors":{"value":false},"fancyzones_makeDraggedWindowTransparent":{"value":false},"fancyzones_zoneColor":{"value":"#F5FCFF"},"fancyzones_zoneBorderColor":{"value":"#FFFFFF"},"fancyzones_zoneHighlightColor":{"value":"#0078D7"},"fancyzones_highlight_opacity":{"value":50},"fancyzones_editor_hotkey":{"value":{"win":true,"ctrl":false,"alt":false,"shift":false,"key":"`","code":192}},"fancyzones_excluded_apps":{"value":""}}}

View File

@@ -0,0 +1 @@
{"properties":{"svg-previewer-toggle-setting":{"value":false},"md-previewer-toggle-setting":{"value":false}},"name":"File Explorer","version":"1.0"}

View File

@@ -0,0 +1,92 @@
{
"version": "1",
"name": "Image Resizer",
"properties": {
"imageresizer_selectedSizeIndex": {
"value": 0
},
"imageresizer_shrinkOnly": {
"value": false
},
"imageresizer_replace": {
"value": false
},
"imageresizer_ignoreOrientation": {
"value": true
},
"imageresizer_jpegQualityLevel": {
"value": 89
},
"imageresizer_pngInterlaceOption": {
"value": 1
},
"imageresizer_tiffCompressOption": {
"value": 2
},
"imageresizer_fileName": {
"value": "%1 (%2)"
},
"imageresizer_sizes": {
"value": [
{
"Id": 0,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Small",
"fit": 1,
"width": 850,
"height": 480,
"unit": 3
},
{
"Id": 1,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Medium",
"fit": 1,
"width": 1363,
"height": 768,
"unit": 3
},
{
"Id": 2,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Large",
"fit": 1,
"width": 1917,
"height": 1080,
"unit": 3
},
{
"Id": 3,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Phone",
"fit": 1,
"width": 316,
"height": 568,
"unit": 3
}
]
},
"imageresizer_keepDateModified": {
"value": true
},
"imageresizer_fallbackEncoder": {
"value": "57a37caa-367a-4540-916b-f183c5093a4b"
},
"imageresizer_customSize": {
"value": {
"Id": 4,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "custom",
"fit": 1,
"width": 1024,
"height": 640,
"unit": 3
}
}
}
}

View File

@@ -0,0 +1,44 @@
{
"value": [
{
"Id": 0,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Small",
"fit": 1,
"width": 850,
"height": 480,
"unit": 3
},
{
"Id": 1,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Medium",
"fit": 1,
"width": 1363,
"height": 768,
"unit": 3
},
{
"Id": 2,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Large",
"fit": 1,
"width": 1917,
"height": 1080,
"unit": 3
},
{
"Id": 3,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Phone",
"fit": 1,
"width": 316,
"height": 568,
"unit": 3
}
]
}

View File

@@ -0,0 +1 @@
{"remapKeys":{"inProcess":[{"originalKeys":"68","newRemapKeys":"65"}]},"remapShortcuts":{"global":[{"originalKeys":"160;20","newRemapKeys":"160;9"}]}}

View File

@@ -0,0 +1 @@
{"properties":{"activeConfiguration":{"value":"default"},"keyboardConfigurations":{"value":["default"]}},"name":"Keyboard Manager","version":"1"}

View File

@@ -0,0 +1 @@
{"Enabled":false,"ShowIcon":false,"ExtendedContextMenuOnly":true,"PersistState":false,"MRUEnabled":false,"MaxMRUSize":10,"SearchText":"","ReplaceText":""}

View File

@@ -0,0 +1 @@
{"properties":{"search_result_preference":"most_recently_used","search_type_preference":"application_name","maximum_number_of_results":8,"open_powerlauncher":{"win":false,"ctrl":false,"alt":false,"shift":true,"key":"P","code":80},"open_file_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"key":"","code":0},"copy_path_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"key":"","code":0},"open_console":{"win":false,"ctrl":false,"alt":false,"shift":false,"key":"","code":0},"override_win_r_key":false,"override_win_s_key":false,"ignore_hotkeys_in_fullscreen":true},"name":"PowerToys Run","version":"1.0"}

View File

@@ -0,0 +1 @@
{"name":"Shortcut Guide","properties":{"overlay_opacity":{"value":32},"press_time":{"value":1150},"theme":{"value":"system"}},"version":"1.0"}

View File

@@ -0,0 +1 @@
{"packaged":false,"startup":true,"enabled":{"FancyZones":true,"File Explorer":true,"Image Resizer":true,"Keyboard Manager":false,"PowerRename":false,"PowerToys Run":true,"Shortcut Guide":false},"is_elevated":false,"run_elevated":false,"download_updates_automatically":false,"is_admin":true,"theme":"light","system_theme":"dark","powertoys_version":"v0.19.2"}

View File

@@ -0,0 +1 @@
{"github_update_last_checked_date":"1601050757","pending_update":false,"pending_installer_filename":""}

View File

@@ -0,0 +1 @@
{"properties":{"ActivationShortcut":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":80,"key":""},"changecursor":{"value":false},"copiedcolorrepresentation":1},"name":"ColorPicker","version":"1.0"}

View File

@@ -0,0 +1 @@
{"version":"1.0","name":"FancyZones","properties":{"fancyzones_shiftDrag":{"value":false},"fancyzones_mouseSwitch":{"value":true},"fancyzones_overrideSnapHotkeys":{"value":true},"fancyzones_moveWindowAcrossMonitors":{"value":true},"fancyzones_displayChange_moveWindows":{"value":true},"fancyzones_zoneSetChange_moveWindows":{"value":true},"fancyzones_appLastZone_moveWindows":{"value":true},"fancyzones_openWindowOnActiveMonitor":{"value":true},"fancyzones_restoreSize":{"value":true},"use_cursorpos_editor_startupscreen":{"value":false},"fancyzones_show_on_all_monitors":{"value":true},"fancyzones_makeDraggedWindowTransparent":{"value":true},"fancyzones_zoneColor":{"value":"#18FCFF"},"fancyzones_zoneBorderColor":{"value":"#C0FF43"},"fancyzones_zoneHighlightColor":{"value":"#0016D7"},"fancyzones_highlight_opacity":{"value":25},"fancyzones_editor_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":87,"key":""}},"fancyzones_excluded_apps":{"value":""}}}

View File

@@ -0,0 +1 @@
{"Properties":{"svg-previewer-toggle-setting":{"value":false},"svg-thumbnail-toggle-setting":{"value":false},"md-previewer-toggle-setting":{"value":false}},"name":"File Explorer","version":"1.0"}

View File

@@ -0,0 +1,92 @@
{
"properties": {
"imageresizer_selectedSizeIndex": {
"value": 0
},
"imageresizer_shrinkOnly": {
"value": false
},
"imageresizer_replace": {
"value": false
},
"imageresizer_ignoreOrientation": {
"value": true
},
"imageresizer_jpegQualityLevel": {
"value": 90
},
"imageresizer_pngInterlaceOption": {
"value": 0
},
"imageresizer_tiffCompressOption": {
"value": 0
},
"imageresizer_fileName": {
"value": "%1 (%2)"
},
"imageresizer_sizes": {
"value": [
{
"Id": 0,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Small",
"fit": 1,
"width": 854,
"height": 480,
"unit": 3
},
{
"Id": 1,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Medium",
"fit": 1,
"width": 1366,
"height": 768,
"unit": 3
},
{
"Id": 2,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Large",
"fit": 1,
"width": 1920,
"height": 1080,
"unit": 3
},
{
"Id": 3,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Phone",
"fit": 1,
"width": 320,
"height": 568,
"unit": 3
}
]
},
"imageresizer_keepDateModified": {
"value": false
},
"imageresizer_fallbackEncoder": {
"value": "19e4a5aa-5662-4fc5-a0c0-1758028e1057"
},
"imageresizer_customSize": {
"value": {
"Id": 4,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "custom",
"fit": 1,
"width": 1024,
"height": 640,
"unit": 3
}
}
},
"name": "Image Resizer",
"version": "1"
}

View File

@@ -0,0 +1,44 @@
{
"value": [
{
"Id": 0,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Small",
"fit": 1,
"width": 854,
"height": 480,
"unit": 3
},
{
"Id": 1,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Medium",
"fit": 1,
"width": 1366,
"height": 768,
"unit": 3
},
{
"Id": 2,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Large",
"fit": 1,
"width": 1920,
"height": 1080,
"unit": 3
},
{
"Id": 3,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Phone",
"fit": 1,
"width": 320,
"height": 568,
"unit": 3
}
]
}

View File

@@ -0,0 +1 @@
{"remapKeys":{"inProcess":[{"originalKeys":"97","newRemapKeys":"65"},{"originalKeys":"83","newRemapKeys":"96"}]},"remapShortcuts":{"global":[{"originalKeys":"162;164;79","newRemapKeys":"164;160;72"}],"appSpecific":[]}}

View File

@@ -0,0 +1 @@
{"properties":{"activeConfiguration":{"value":"default"},"keyboardConfigurations":{"value":["default"]}},"name":"Keyboard Manager","version":"1"}

View File

@@ -0,0 +1 @@
{"Enabled":false,"ShowIcon":false,"ExtendedContextMenuOnly":true,"PersistState":false,"MRUEnabled":false,"MaxMRUSize":6,"SearchText":"","ReplaceText":""}

View File

@@ -0,0 +1 @@
{"properties":{"search_result_preference":"most_recently_used","search_type_preference":"application_name","maximum_number_of_results":8,"open_powerlauncher":{"win":true,"ctrl":false,"alt":false,"shift":false,"code":80,"key":""},"open_file_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"copy_path_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"open_console":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"override_win_r_key":false,"override_win_s_key":false,"ignore_hotkeys_in_fullscreen":true,"disable_drive_detection_warning":true,"clear_input_on_launch":true},"name":"PowerToys Run","version":"1.0"}

View File

@@ -0,0 +1 @@
{"properties":{"overlay_opacity":{"value":21},"press_time":{"value":650},"theme":{"value":"dark"}},"name":"Shortcut Guide","version":"1.0"}

View File

@@ -0,0 +1 @@
{"packaged":false,"startup":false,"enabled":{"ColorPicker":true,"FancyZones":false,"File Explorer":true,"Image Resizer":true,"Keyboard Manager":false,"PowerRename":false,"PowerToys Run":false,"Shortcut Guide":false},"is_elevated":false,"run_elevated":false,"download_updates_automatically":false,"is_admin":true,"theme":"light","system_theme":"dark","powertoys_version":"v0.20.1"}

View File

@@ -0,0 +1 @@
{"github_update_last_checked_date":"1601057084","pending_update":false,"pending_installer_filename":""}

View File

@@ -0,0 +1 @@
{"properties":{"ActivationShortcut":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":83,"key":""},"changecursor":{"value":false},"copiedcolorrepresentation":1},"name":"ColorPicker","version":"1.0"}

View File

@@ -0,0 +1 @@
{"version":"1.0","name":"FancyZones","properties":{"fancyzones_shiftDrag":{"value":false},"fancyzones_mouseSwitch":{"value":true},"fancyzones_overrideSnapHotkeys":{"value":true},"fancyzones_moveWindowAcrossMonitors":{"value":true},"fancyzones_moveWindowsBasedOnPosition":{"value":true},"fancyzones_displayChange_moveWindows":{"value":true},"fancyzones_zoneSetChange_moveWindows":{"value":true},"fancyzones_appLastZone_moveWindows":{"value":true},"fancyzones_openWindowOnActiveMonitor":{"value":true},"fancyzones_restoreSize":{"value":true},"use_cursorpos_editor_startupscreen":{"value":true},"fancyzones_show_on_all_monitors":{"value":true},"fancyzones_span_zones_across_monitors":{"value":true},"fancyzones_makeDraggedWindowTransparent":{"value":true},"fancyzones_zoneColor":{"value":"#FF6B1A"},"fancyzones_zoneBorderColor":{"value":"#C4B9FF"},"fancyzones_zoneHighlightColor":{"value":"#D7115F"},"fancyzones_highlight_opacity":{"value":15},"fancyzones_editor_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":83,"key":""}},"fancyzones_excluded_apps":{"value":""}}}

View File

@@ -0,0 +1 @@
{"Properties":{"svg-previewer-toggle-setting":{"value":false},"svg-thumbnail-toggle-setting":{"value":false},"md-previewer-toggle-setting":{"value":false}},"name":"File Explorer","version":"1.0"}

View File

@@ -0,0 +1,92 @@
{
"properties": {
"imageresizer_selectedSizeIndex": {
"value": 0
},
"imageresizer_shrinkOnly": {
"value": false
},
"imageresizer_replace": {
"value": false
},
"imageresizer_ignoreOrientation": {
"value": true
},
"imageresizer_jpegQualityLevel": {
"value": 89
},
"imageresizer_pngInterlaceOption": {
"value": 1
},
"imageresizer_tiffCompressOption": {
"value": 1
},
"imageresizer_fileName": {
"value": "%1 (%2)"
},
"imageresizer_sizes": {
"value": [
{
"Id": 0,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Small",
"fit": 1,
"width": 853,
"height": 479,
"unit": 3
},
{
"Id": 1,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Medium",
"fit": 1,
"width": 1365,
"height": 767,
"unit": 3
},
{
"Id": 2,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Large",
"fit": 1,
"width": 1919,
"height": 1079,
"unit": 3
},
{
"Id": 3,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Phone",
"fit": 1,
"width": 319,
"height": 567,
"unit": 3
}
]
},
"imageresizer_keepDateModified": {
"value": true
},
"imageresizer_fallbackEncoder": {
"value": "163bcc30-e2e9-4f0b-961d-a3e9fdb788a3"
},
"imageresizer_customSize": {
"value": {
"Id": 4,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "custom",
"fit": 1,
"width": 1024,
"height": 640,
"unit": 3
}
}
},
"name": "Image Resizer",
"version": "1"
}

View File

@@ -0,0 +1,44 @@
{
"value": [
{
"Id": 0,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Small",
"fit": 1,
"width": 853,
"height": 479,
"unit": 3
},
{
"Id": 1,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Medium",
"fit": 1,
"width": 1365,
"height": 767,
"unit": 3
},
{
"Id": 2,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Large",
"fit": 1,
"width": 1919,
"height": 1079,
"unit": 3
},
{
"Id": 3,
"ExtraBoxOpacity": 100,
"EnableEtraBoxes": true,
"name": "Phone",
"fit": 1,
"width": 319,
"height": 567,
"unit": 3
}
]
}

View File

@@ -0,0 +1 @@
{"remapKeys":{"inProcess":[{"originalKeys":"65","newRemapKeys":"69"}]},"remapShortcuts":{"global":[{"originalKeys":"160;68","newRemapKeys":"9"}],"appSpecific":[]}}

View File

@@ -0,0 +1 @@
{"properties":{"activeConfiguration":{"value":"default"},"keyboardConfigurations":{"value":["default"]}},"name":"Keyboard Manager","version":"1"}

View File

@@ -0,0 +1 @@
{"Enabled":false,"ShowIcon":false,"ExtendedContextMenuOnly":true,"PersistState":false,"MRUEnabled":true,"MaxMRUSize":6,"SearchText":"","ReplaceText":""}

View File

@@ -0,0 +1 @@
{"properties":{"search_result_preference":"most_recently_used","search_type_preference":"application_name","maximum_number_of_results":1,"open_powerlauncher":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":68,"key":""},"open_file_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"copy_path_location":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"open_console":{"win":false,"ctrl":false,"alt":false,"shift":false,"code":0,"key":""},"override_win_r_key":false,"override_win_s_key":false,"ignore_hotkeys_in_fullscreen":true,"disable_drive_detection_warning":true,"clear_input_on_launch":true},"name":"PowerToys Run","version":"1.0"}

View File

@@ -0,0 +1 @@
{"properties":{"overlay_opacity":{"value":92},"press_time":{"value":850},"theme":{"value":"dark"}},"name":"Shortcut Guide","version":"1.0"}

View File

@@ -0,0 +1 @@
{"version":"1.0","name":"Video Conference","properties":{"mute_camera_and_microphone_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":73,"key":""}},"mute_microphone_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":68,"key":""}},"mute_camera_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":86,"key":""}},"selected_camera":{"value":"USB Video Device"},"toolbar_position":{"value":"Bottom center"},"toolbar_monitor":{"value":"All monitors"},"camera_overlay_image_path":{"value":""},"theme":{"value":"light"},"hide_toolbar_when_unmuted":{"value":false}}}

View File

@@ -0,0 +1 @@
{"packaged":false,"startup":false,"enabled":{"ColorPicker":false,"FancyZones":false,"File Explorer":true,"Image Resizer":false,"Keyboard Manager":false,"PowerRename":false,"PowerToys Run":false,"Shortcut Guide":true,"Video Conference":false},"is_elevated":false,"run_elevated":false,"download_updates_automatically":false,"is_admin":true,"theme":"light","system_theme":"dark","powertoys_version":"v0.22.0"}

View File

@@ -0,0 +1 @@
{"github_update_last_checked_date":"1601060698","pending_update":false,"pending_installer_filename":""}

View File

@@ -2,6 +2,8 @@
using Moq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq.Expressions;
using System.Text;
namespace Microsoft.PowerToys.Settings.UI.UnitTests.Mocks
@@ -34,5 +36,35 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.Mocks
return mockIOProvider;
}
/// <summary>
/// This method mocks an IO provider so that it will always return data at the savePath location.
/// This mock is specific to a given module, and is verifiable that the stub file was read.
/// </summary>
/// <param name="savePath">The path to the stub settings file</param>
/// <param name="expectedPathSubstring">The substring in the path that identifies the module eg. Microsoft\\PowerToys\\ColorPicker</param>
/// <returns></returns>
internal static Mock<IIOProvider> GetMockIOReadWithStubFile(string savePath, Expression<Func<string, bool>> filterExpression)
{
string saveContent = File.ReadAllText(savePath);
var mockIOProvider = new Mock<IIOProvider>();
mockIOProvider.Setup(x => x.ReadAllText(It.Is<string>(filterExpression)))
.Returns(() => saveContent).Verifiable();
mockIOProvider.Setup(x => x.FileExists(It.Is<string>(filterExpression)))
.Returns(true);
return mockIOProvider;
}
internal static void VerifyIOReadWithStubFile(Mock<IIOProvider> mockIOProvider, Expression<Func<string, bool>> filterExpression, int expectedCallCount)
{
mockIOProvider.Verify(x => x.ReadAllText(It.Is<string>(filterExpression)), Times.Exactly(expectedCallCount));
}
}
}

View File

@@ -2,6 +2,13 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Globalization;
using System.IO;
using System.Text.Json;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ViewModelTests
@@ -9,6 +16,56 @@ namespace ViewModelTests
[TestClass]
public class ColorPicker
{
/// <summary>
/// Test if the original settings files were modified.
/// </summary>
[TestMethod]
[DataRow("v0.20.1", "settings.json")] //Color picker was introduced in .20
[DataRow("v0.21.1", "settings.json")]
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
//Arrange
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, ColorPickerSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object);
ColorPickerSettings originalSettings = mockSettingsUtils.GetSettings<ColorPickerSettings>(ColorPickerSettings.ModuleName);
var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object);
GeneralSettings originalGeneralSettings = mockGeneralSettingsUtils.GetSettings<GeneralSettings>();
var generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
//Act
// Initialise View Model with test Config files
ColorPickerViewModel viewModel = new ColorPickerViewModel(mockSettingsUtils, generalSettingsRepository, ColorPickerIsEnabledByDefaultIPC);
//Assert
// Verifiy that the old settings persisted
Assert.AreEqual(originalGeneralSettings.Enabled.ColorPicker, viewModel.IsEnabled);
Assert.AreEqual(originalSettings.Properties.ActivationShortcut.ToString(), viewModel.ActivationShortcut.ToString());
Assert.AreEqual(originalSettings.Properties.ChangeCursor, viewModel.ChangeCursor);
//Verify that the stub file was used
var expectedCallCount = 2; //once via the view model, and once by the test (GetSettings<T>)
BackCompatTestProperties.VerifyModuleIOProviderWasRead(mockIOProvider, ColorPickerSettings.ModuleName, expectedCallCount);
BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
}
[TestMethod]
public void ColorPickerIsEnabledByDefault()
{
var mockSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ColorPickerSettings>();
var viewModel = new ColorPickerViewModel(ISettingsUtilsMocks.GetStubSettingsUtils<ColorPickerSettings>().Object, SettingsRepository<GeneralSettings>.GetInstance(ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>().Object), ColorPickerIsEnabledByDefaultIPC);
Assert.IsTrue(viewModel.IsEnabled);
}
private static int ColorPickerIsEnabledByDefaultIPC(string msg)
{
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
Assert.IsTrue(snd.GeneralSettings.Enabled.ColorPicker);
return 0;
}
}
}

View File

@@ -4,11 +4,13 @@
using System;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Text.Json;
using CommonLibTest;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -20,6 +22,66 @@ namespace ViewModelTests
{
public const string FancyZonesTestFolderName = "Test\\FancyZones";
/// <summary>
/// Test if the original settings files were modified.
/// </summary>
[TestMethod]
[DataRow("v0.18.2", "settings.json")]
[DataRow("v0.19.2", "settings.json")]
[DataRow("v0.20.1", "settings.json")]
[DataRow("v0.21.1", "settings.json")]
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, FancyZonesSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object);
FancyZonesSettings originalSettings = mockSettingsUtils.GetSettings<FancyZonesSettings>(FancyZonesSettings.ModuleName);
var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object);
GeneralSettings originalGeneralSettings = mockGeneralSettingsUtils.GetSettings<GeneralSettings>();
var generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
var fancyZonesRepository = new BackCompatTestProperties.MockSettingsRepository<FancyZonesSettings>(mockSettingsUtils);
// Initialise View Model with test Config files
FancyZonesViewModel viewModel = new FancyZonesViewModel(generalSettingsRepository, fancyZonesRepository, ColorPickerIsEnabledByDefault_IPC);
// Verifiy that the old settings persisted
Assert.AreEqual(originalGeneralSettings.Enabled.FancyZones, viewModel.IsEnabled);
Assert.AreEqual(originalSettings.Properties.FancyzonesAppLastZoneMoveWindows.Value, viewModel.AppLastZoneMoveWindows);
Assert.AreEqual(originalSettings.Properties.FancyzonesBorderColor.Value, viewModel.ZoneBorderColor);
Assert.AreEqual(originalSettings.Properties.FancyzonesDisplayChangeMoveWindows.Value, viewModel.DisplayChangeMoveWindows);
Assert.AreEqual(originalSettings.Properties.FancyzonesEditorHotkey.Value.ToString(), viewModel.EditorHotkey.ToString());
Assert.AreEqual(originalSettings.Properties.FancyzonesExcludedApps.Value, viewModel.ExcludedApps);
Assert.AreEqual(originalSettings.Properties.FancyzonesHighlightOpacity.Value, viewModel.HighlightOpacity);
Assert.AreEqual(originalSettings.Properties.FancyzonesInActiveColor.Value, viewModel.ZoneInActiveColor);
Assert.AreEqual(originalSettings.Properties.FancyzonesMakeDraggedWindowTransparent.Value, viewModel.MakeDraggedWindowsTransparent);
Assert.AreEqual(originalSettings.Properties.FancyzonesMouseSwitch.Value, viewModel.MouseSwitch);
Assert.AreEqual(originalSettings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value, viewModel.MoveWindowsAcrossMonitors);
Assert.AreEqual(originalSettings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value, viewModel.MoveWindowsBasedOnPosition);
Assert.AreEqual(originalSettings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value, viewModel.OpenWindowOnActiveMonitor);
Assert.AreEqual(originalSettings.Properties.FancyzonesOverrideSnapHotkeys.Value, viewModel.OverrideSnapHotkeys);
Assert.AreEqual(originalSettings.Properties.FancyzonesRestoreSize.Value, viewModel.RestoreSize);
Assert.AreEqual(originalSettings.Properties.FancyzonesShiftDrag.Value, viewModel.ShiftDrag);
Assert.AreEqual(originalSettings.Properties.FancyzonesShowOnAllMonitors.Value, viewModel.ShowOnAllMonitors);
Assert.AreEqual(originalSettings.Properties.FancyzonesSpanZonesAcrossMonitors.Value, viewModel.SpanZonesAcrossMonitors);
Assert.AreEqual(originalSettings.Properties.FancyzonesZoneHighlightColor.Value, viewModel.ZoneHighlightColor);
Assert.AreEqual(originalSettings.Properties.FancyzonesZoneSetChangeMoveWindows.Value, viewModel.ZoneSetChangeMoveWindows);
Assert.AreEqual(originalSettings.Properties.UseCursorposEditorStartupscreen.Value, viewModel.UseCursorPosEditorStartupScreen);
//Verify that the stub file was used
var expectedCallCount = 2; //once via the view model, and once by the test (GetSettings<T>)
BackCompatTestProperties.VerifyModuleIOProviderWasRead(mockIOProvider, FancyZonesSettings.ModuleName, expectedCallCount);
BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
}
private int ColorPickerIsEnabledByDefault_IPC(string msg)
{
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
Assert.IsTrue(snd.GeneralSettings.Enabled.ColorPicker);
return 0;
}
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
private Mock<ISettingsUtils> mockFancyZonesSettingsUtils;

View File

@@ -3,12 +3,14 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Globalization;
using System.IO;
using System.Text.Json;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NuGet.Frameworks;
@@ -21,11 +23,56 @@ namespace ViewModelTests
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
[TestInitialize]
public void SetUpStubSettingUtils()
{
mockGeneralSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>();
}
/// </summary>
[TestMethod]
[DataRow("v0.18.2")]
[DataRow("v0.19.2")]
[DataRow("v0.20.1")]
[DataRow("v0.21.1")]
[DataRow("v0.22.0")]
public void OriginalFilesModificationTest(string version)
{
var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object);
GeneralSettings originalGeneralSettings = mockGeneralSettingsUtils.GetSettings<GeneralSettings>();
var generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
// Initialise View Model with test Config files
// Arrange
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
Func<string, int> SendRestartAdminIPCMessage = msg => { return 0; };
Func<string, int> SendCheckForUpdatesIPCMessage = msg => { return 0; };
var viewModel = new GeneralViewModel(
settingsRepository: generalSettingsRepository,
runAsAdminText: "GeneralSettings_RunningAsAdminText",
runAsUserText: "GeneralSettings_RunningAsUserText",
isElevated: false,
isAdmin: false,
updateTheme: UpdateUIThemeMethod,
ipcMSGCallBackFunc: SendMockIPCConfigMSG,
ipcMSGRestartAsAdminMSGCallBackFunc: SendRestartAdminIPCMessage,
ipcMSGCheckForUpdatesCallBackFunc: SendCheckForUpdatesIPCMessage,
configFileSubfolder: string.Empty);
// Verifiy that the old settings persisted
Assert.AreEqual(originalGeneralSettings.AutoDownloadUpdates, viewModel.AutoDownloadUpdates);
Assert.AreEqual(originalGeneralSettings.Packaged, viewModel.Packaged);
Assert.AreEqual(originalGeneralSettings.PowertoysVersion, viewModel.PowerToysVersion);
Assert.AreEqual(originalGeneralSettings.RunElevated, viewModel.RunElevated);
Assert.AreEqual(originalGeneralSettings.Startup, viewModel.Startup);
//Verify that the stub file was used
var expectedCallCount = 2; //once via the view model, and once by the test (GetSettings<T>)
BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
}
[TestMethod]
public void IsElevatedShouldUpdateRunasAdminStatusAttrsWhenSuccessful()

View File

@@ -3,12 +3,14 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.Utilities;
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -18,7 +20,6 @@ namespace ViewModelTests
[TestClass]
public class ImageResizer
{
public const string Module = "ImageResizer";
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
@@ -31,6 +32,47 @@ namespace ViewModelTests
mockImgResizerSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ImageResizerSettings>();
}
/// <summary>
/// Test if the original settings files were modified.
/// </summary>
[TestMethod]
[DataRow("v0.18.2", "settings.json")]
[DataRow("v0.19.2", "settings.json")]
[DataRow("v0.20.1", "settings.json")]
[DataRow("v0.21.1", "settings.json")]
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, ImageResizerSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object);
ImageResizerSettings originalSettings = mockSettingsUtils.GetSettings<ImageResizerSettings>(ImageResizerSettings.ModuleName);
var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object);
GeneralSettings originalGeneralSettings = mockGeneralSettingsUtils.GetSettings<GeneralSettings>();
var generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
// Initialise View Model with test Config files
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
ImageResizerViewModel viewModel = new ImageResizerViewModel(mockSettingsUtils, generalSettingsRepository, SendMockIPCConfigMSG);
// Verifiy that the old settings persisted
Assert.AreEqual(originalGeneralSettings.Enabled.ImageResizer, viewModel.IsEnabled);
Assert.AreEqual(viewModel.GetEncoderIndex(originalSettings.Properties.ImageresizerFallbackEncoder.Value), viewModel.Encoder);
Assert.AreEqual(originalSettings.Properties.ImageresizerFileName.Value, viewModel.FileName);
Assert.AreEqual(originalSettings.Properties.ImageresizerJpegQualityLevel.Value, viewModel.JPEGQualityLevel);
Assert.AreEqual(originalSettings.Properties.ImageresizerKeepDateModified.Value, viewModel.KeepDateModified);
Assert.AreEqual(originalSettings.Properties.ImageresizerPngInterlaceOption.Value, viewModel.PngInterlaceOption);
Assert.AreEqual(originalSettings.Properties.ImageresizerSizes.Value.Count, viewModel.Sizes.Count);
Assert.AreEqual(originalSettings.Properties.ImageresizerTiffCompressOption.Value, viewModel.TiffCompressOption);
//Verify that the stub file was used
var expectedCallCount = 2; //once via the view model, and once by the test (GetSettings<T>)
BackCompatTestProperties.VerifyModuleIOProviderWasRead(mockIOProvider, ImageResizerSettings.ModuleName, expectedCallCount);
BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
}
[TestMethod]
public void IsEnabledShouldEnableModuleWhenSuccessful()
{
@@ -127,7 +169,7 @@ namespace ViewModelTests
var expectedSettingsString = new ImageResizerSettings() { Properties = new ImageResizerProperties() { ImageresizerKeepDateModified = new BoolProperty() { Value = true } } }.ToJsonString();
settingUtils.Setup(x => x.SaveSettings(
It.Is<string>(content => content.Equals(expectedSettingsString, StringComparison.Ordinal)),
It.Is<string>(module => module.Equals(Module, StringComparison.Ordinal)),
It.Is<string>(module => module.Equals(ImageResizerSettings.ModuleName, StringComparison.Ordinal)),
It.IsAny<string>()))
.Verifiable();

View File

@@ -5,7 +5,11 @@
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Moq;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility;
using System.Globalization;
namespace ViewModelTests
{
@@ -37,6 +41,49 @@ namespace ViewModelTests
new PowerLauncherViewModel.SendCallback(sendCallbackMock.OnSend));
}
/// <summary>
/// Test if the original settings files were modified.
/// </summary>
[TestMethod]
[DataRow("v0.18.2", "settings.json")]
[DataRow("v0.19.2", "settings.json")]
[DataRow("v0.20.1", "settings.json")]
[DataRow("v0.21.1", "settings.json")]
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, PowerLauncherSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object);
PowerLauncherSettings originalSettings = mockSettingsUtils.GetSettings<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object);
GeneralSettings originalGeneralSettings = mockGeneralSettingsUtils.GetSettings<GeneralSettings>();
var generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
// Initialise View Model with test Config files
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
PowerLauncherViewModel viewModel = new PowerLauncherViewModel(mockSettingsUtils, generalSettingsRepository, SendMockIPCConfigMSG, 32);
// Verifiy that the old settings persisted
Assert.AreEqual(originalGeneralSettings.Enabled.PowerLauncher, viewModel.EnablePowerLauncher);
Assert.AreEqual(originalSettings.Properties.ClearInputOnLaunch, viewModel.ClearInputOnLaunch);
Assert.AreEqual(originalSettings.Properties.CopyPathLocation.ToString(), viewModel.CopyPathLocation.ToString());
Assert.AreEqual(originalSettings.Properties.DisableDriveDetectionWarning, viewModel.DisableDriveDetectionWarning);
Assert.AreEqual(originalSettings.Properties.IgnoreHotkeysInFullscreen, viewModel.IgnoreHotkeysInFullScreen);
Assert.AreEqual(originalSettings.Properties.MaximumNumberOfResults, viewModel.MaximumNumberOfResults);
Assert.AreEqual(originalSettings.Properties.OpenPowerLauncher.ToString(), viewModel.OpenPowerLauncher.ToString());
Assert.AreEqual(originalSettings.Properties.OverrideWinkeyR, viewModel.OverrideWinRKey);
Assert.AreEqual(originalSettings.Properties.OverrideWinkeyS, viewModel.OverrideWinSKey);
Assert.AreEqual(originalSettings.Properties.SearchResultPreference, viewModel.SearchResultPreference);
Assert.AreEqual(originalSettings.Properties.SearchTypePreference, viewModel.SearchTypePreference);
//Verify that the stub file was used
var expectedCallCount = 2; //once via the view model, and once by the test (GetSettings<T>)
BackCompatTestProperties.VerifyModuleIOProviderWasRead(mockIOProvider, PowerLauncherSettings.ModuleName, expectedCallCount);
BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
}
[TestMethod]
public void SearchPreferenceShouldUpdatePreferences()
{

View File

@@ -7,6 +7,7 @@ using System.IO;
using System.Text.Json;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -16,7 +17,6 @@ namespace ViewModelTests
[TestClass]
public class PowerPreview
{
public const string Module = "Test\\File Explorer";
private Mock<ISettingsUtils> mockPowerPreviewSettingsUtils;
@@ -26,6 +26,37 @@ namespace ViewModelTests
mockPowerPreviewSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<PowerPreviewSettings>();
}
/// <summary>
/// Test if the original settings files were modified.
/// </summary>
[TestMethod]
[DataRow("v0.18.2", "settings.json")]
[DataRow("v0.19.2", "settings.json")]
[DataRow("v0.20.1", "settings.json")]
[DataRow("v0.21.1", "settings.json")]
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, PowerPreviewSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object);
PowerPreviewSettings originalSettings = mockSettingsUtils.GetSettings<PowerPreviewSettings>(PowerPreviewSettings.ModuleName);
var repository = new BackCompatTestProperties.MockSettingsRepository<PowerPreviewSettings>(mockSettingsUtils);
// Initialise View Model with test Config files
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
PowerPreviewViewModel viewModel = new PowerPreviewViewModel(repository, SendMockIPCConfigMSG);
// Verifiy that the old settings persisted
Assert.AreEqual(originalSettings.Properties.EnableMdPreview, viewModel.MDRenderIsEnabled);
Assert.AreEqual(originalSettings.Properties.EnableSvgPreview, viewModel.SVGRenderIsEnabled);
Assert.AreEqual(originalSettings.Properties.EnableSvgThumbnail, viewModel.SVGThumbnailIsEnabled);
//Verify that the stub file was used
var expectedCallCount = 2; //once via the view model, and once by the test (GetSettings<T>)
BackCompatTestProperties.VerifyModuleIOProviderWasRead(mockIOProvider, PowerPreviewSettings.ModuleName, expectedCallCount);
}
[TestMethod]
public void SVGRenderIsEnabledShouldPrevHandlerWhenSuccessful()
{
@@ -38,7 +69,7 @@ namespace ViewModelTests
};
// arrange
PowerPreviewViewModel viewModel = new PowerPreviewViewModel(SettingsRepository<PowerPreviewSettings>.GetInstance(mockPowerPreviewSettingsUtils.Object), SendMockIPCConfigMSG, Module);
PowerPreviewViewModel viewModel = new PowerPreviewViewModel(SettingsRepository<PowerPreviewSettings>.GetInstance(mockPowerPreviewSettingsUtils.Object), SendMockIPCConfigMSG, PowerPreviewSettings.ModuleName);
// act
viewModel.SVGRenderIsEnabled = true;
@@ -56,7 +87,7 @@ namespace ViewModelTests
};
// arrange
PowerPreviewViewModel viewModel = new PowerPreviewViewModel(SettingsRepository<PowerPreviewSettings>.GetInstance(mockPowerPreviewSettingsUtils.Object), SendMockIPCConfigMSG, Module);
PowerPreviewViewModel viewModel = new PowerPreviewViewModel(SettingsRepository<PowerPreviewSettings>.GetInstance(mockPowerPreviewSettingsUtils.Object), SendMockIPCConfigMSG, PowerPreviewSettings.ModuleName);
// act
viewModel.SVGThumbnailIsEnabled = true;
@@ -74,7 +105,7 @@ namespace ViewModelTests
};
// arrange
PowerPreviewViewModel viewModel = new PowerPreviewViewModel(SettingsRepository<PowerPreviewSettings>.GetInstance(mockPowerPreviewSettingsUtils.Object), SendMockIPCConfigMSG, Module); ;
PowerPreviewViewModel viewModel = new PowerPreviewViewModel(SettingsRepository<PowerPreviewSettings>.GetInstance(mockPowerPreviewSettingsUtils.Object), SendMockIPCConfigMSG, PowerPreviewSettings.ModuleName);
// act
viewModel.MDRenderIsEnabled = true;

View File

@@ -7,6 +7,7 @@ using System.IO;
using System.Text.Json;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -16,7 +17,6 @@ namespace ViewModelTests
[TestClass]
public class PowerRename
{
public const string ModuleName = PowerRenameSettings.ModuleName;
public const string generalSettingsFileName = "Test\\PowerRename";
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
@@ -30,6 +30,41 @@ namespace ViewModelTests
mockPowerRenamePropertiesUtils = ISettingsUtilsMocks.GetStubSettingsUtils<PowerRenameLocalProperties>();
}
/// <summary>
/// Test if the original settings files were modified.
/// </summary>
[TestMethod]
[DataRow("v0.18.2", "power-rename-settings.json")]
[DataRow("v0.19.2", "power-rename-settings.json")]
[DataRow("v0.20.1", "power-rename-settings.json")]
[DataRow("v0.22.0", "power-rename-settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, PowerRenameSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object);
PowerRenameLocalProperties originalSettings = mockSettingsUtils.GetSettings<PowerRenameLocalProperties>(PowerRenameSettings.ModuleName);
var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object);
GeneralSettings originalGeneralSettings = mockGeneralSettingsUtils.GetSettings<GeneralSettings>();
var generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
// Initialise View Model with test Config files
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
PowerRenameViewModel viewModel = new PowerRenameViewModel(mockSettingsUtils, generalSettingsRepository, SendMockIPCConfigMSG);
// Verifiy that the old settings persisted
Assert.AreEqual(originalGeneralSettings.Enabled.PowerRename, viewModel.IsEnabled);
Assert.AreEqual(originalSettings.ExtendedContextMenuOnly, viewModel.EnabledOnContextExtendedMenu);
Assert.AreEqual(originalSettings.MRUEnabled, viewModel.MRUEnabled);
Assert.AreEqual(originalSettings.ShowIcon, viewModel.EnabledOnContextMenu);
//Verify that the stub file was used
var expectedCallCount = 2; //once via the view model, and once by the test (GetSettings<T>)
BackCompatTestProperties.VerifyModuleIOProviderWasRead(mockIOProvider, PowerRenameSettings.ModuleName, expectedCallCount);
BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
}
[TestMethod]
public void IsEnabledShouldEnableModuleWhenSuccessful()
{

View File

@@ -7,6 +7,7 @@ using System.IO;
using System.Text.Json;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Lib.ViewModels;
using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility;
using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -18,6 +19,42 @@ namespace ViewModelTests
{
public const string ShortCutGuideTestFolderName = "Test\\ShortCutGuide";
/// <summary>
/// Test if the original settings files were modified.
/// </summary>
[TestMethod]
[DataRow("v0.18.2", "settings.json")]
[DataRow("v0.19.2", "settings.json")]
[DataRow("v0.20.1", "settings.json")]
[DataRow("v0.21.1", "settings.json")]
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, ShortcutGuideSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object);
ShortcutGuideSettings originalSettings = mockSettingsUtils.GetSettings<ShortcutGuideSettings>(ShortcutGuideSettings.ModuleName);
var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object);
GeneralSettings originalGeneralSettings = mockGeneralSettingsUtils.GetSettings<GeneralSettings>();
var generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
var shortcutSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<ShortcutGuideSettings>(mockSettingsUtils);
// Initialise View Model with test Config files
Func<string, int> SendMockIPCConfigMSG = msg => { return 0; };
ShortcutGuideViewModel viewModel = new ShortcutGuideViewModel(generalSettingsRepository, shortcutSettingsRepository, SendMockIPCConfigMSG);
// Verifiy that the old settings persisted
Assert.AreEqual(originalGeneralSettings.Enabled.ShortcutGuide, viewModel.IsEnabled);
Assert.AreEqual(originalSettings.Properties.OverlayOpacity.Value, viewModel.OverlayOpacity);
Assert.AreEqual(originalSettings.Properties.PressTime.Value, viewModel.PressTime);
//Verify that the stub file was used
var expectedCallCount = 2; //once via the view model, and once by the test (GetSettings<T>)
BackCompatTestProperties.VerifyModuleIOProviderWasRead(mockIOProvider, ShortcutGuideSettings.ModuleName, expectedCallCount);
BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
}
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
private Mock<ISettingsUtils> mockShortcutGuideSettingsUtils;