mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[OOBE]Fix not shortcut not updating (#21175)
* [OOBE]Fix not shortcut not updating Fix for issue #20953. Activation key update in the OOBE window when the user changes it in the settings window. Add settings repository reference to the ViewModel constructor to use the repository settings object (and not create a second instance of it). * Fix for issue #20953. Unit test fixed.
This commit is contained in:
@@ -36,10 +36,15 @@ namespace ViewModelTests
|
||||
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object, settingPathMock.Object);
|
||||
GeneralSettings originalGeneralSettings = mockGeneralSettingsUtils.GetSettingsOrDefault<GeneralSettings>();
|
||||
var generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
|
||||
var colorPickerSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<ColorPickerSettings>(mockSettingsUtils);
|
||||
|
||||
// Act
|
||||
// Initialise View Model with test Config files
|
||||
using (var viewModel = new ColorPickerViewModel(mockSettingsUtils, generalSettingsRepository, ColorPickerIsEnabledByDefaultIPC))
|
||||
using (var viewModel = new ColorPickerViewModel(
|
||||
mockSettingsUtils,
|
||||
generalSettingsRepository,
|
||||
colorPickerSettingsRepository,
|
||||
ColorPickerIsEnabledByDefaultIPC))
|
||||
{
|
||||
// Assert
|
||||
// Verify that the old settings persisted
|
||||
@@ -58,7 +63,11 @@ namespace ViewModelTests
|
||||
public void ColorPickerIsEnabledByDefault()
|
||||
{
|
||||
var mockSettingsUtils = ISettingsUtilsMocks.GetStubSettingsUtils<ColorPickerSettings>();
|
||||
using (var viewModel = new ColorPickerViewModel(ISettingsUtilsMocks.GetStubSettingsUtils<ColorPickerSettings>().Object, SettingsRepository<GeneralSettings>.GetInstance(ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>().Object), ColorPickerIsEnabledByDefaultIPC))
|
||||
using (var viewModel = new ColorPickerViewModel(
|
||||
ISettingsUtilsMocks.GetStubSettingsUtils<ColorPickerSettings>().Object,
|
||||
SettingsRepository<GeneralSettings>.GetInstance(ISettingsUtilsMocks.GetStubSettingsUtils<GeneralSettings>().Object),
|
||||
SettingsRepository<ColorPickerSettings>.GetInstance(new SettingsUtils()),
|
||||
ColorPickerIsEnabledByDefaultIPC))
|
||||
{
|
||||
Assert.IsTrue(viewModel.IsEnabled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user