예제 #1
0
        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);
        }
예제 #2
0
        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(ImageResizerViewModel.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);
        }
예제 #3
0
        public void OriginalFilesModificationTest(string version, string fileName)
        {
            // Arrange
            var mockIOProvider  = BackCompatTestProperties.GetModuleIOProvider(version, ColorPickerSettings.ModuleName, fileName);
            var settingPathMock = new Mock <ISettingsPath>();

            var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object, settingPathMock.Object);
            ColorPickerSettings originalSettings = mockSettingsUtils.GetSettings <ColorPickerSettings>(ColorPickerSettings.ModuleName);

            var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);

            var             mockGeneralSettingsUtils  = new SettingsUtils(mockGeneralIOProvider.Object, settingPathMock.Object);
            GeneralSettings originalGeneralSettings   = mockGeneralSettingsUtils.GetSettings <GeneralSettings>();
            var             generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository <GeneralSettings>(mockGeneralSettingsUtils);

            // Act
            // Initialise View Model with test Config files
            using (var viewModel = new ColorPickerViewModel(mockSettingsUtils, generalSettingsRepository, ColorPickerIsEnabledByDefaultIPC))
            {
                // Assert
                // Verify 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);
            }
        }
예제 #4
0
        public void OriginalFilesModificationTest(string version, string fileName)
        {
            var settingPathMock = new Mock <ISettingsPath>();
            var fileMock        = BackCompatTestProperties.GetModuleIOProvider(version, PowerPreviewSettings.ModuleName, fileName);

            var mockSettingsUtils = new SettingsUtils(fileMock.Object, settingPathMock.Object);
            PowerPreviewSettings originalSettings = mockSettingsUtils.GetSettingsOrDefault <PowerPreviewSettings>(PowerPreviewSettings.ModuleName);
            var repository = new BackCompatTestProperties.MockSettingsRepository <PowerPreviewSettings>(mockSettingsUtils);

            var             mockGeneralIOProvider     = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
            var             mockGeneralSettingsUtils  = new SettingsUtils(mockGeneralIOProvider.Object, settingPathMock.Object);
            GeneralSettings originalGeneralSettings   = mockGeneralSettingsUtils.GetSettingsOrDefault <GeneralSettings>();
            var             generalSettingsRepository = new BackCompatTestProperties.MockSettingsRepository <GeneralSettings>(mockGeneralSettingsUtils);

            // Initialise View Model with test Config files
            Func <string, int>    sendMockIPCConfigMSG = msg => { return(0); };
            PowerPreviewViewModel viewModel            = new PowerPreviewViewModel(repository, generalSettingsRepository, sendMockIPCConfigMSG);

            // Verify that the old settings persisted
            Assert.AreEqual(originalGeneralSettings.IsElevated, viewModel.IsElevated);
            Assert.AreEqual(originalSettings.Properties.EnableMdPreview, viewModel.MDRenderIsEnabled);
            Assert.AreEqual(originalSettings.Properties.EnablePdfPreview, viewModel.PDFRenderIsEnabled);
            Assert.AreEqual(originalSettings.Properties.EnableGcodePreview, viewModel.GCODERenderIsEnabled);
            Assert.AreEqual(originalSettings.Properties.EnableSvgPreview, viewModel.SVGRenderIsEnabled);
            Assert.AreEqual(originalSettings.Properties.EnableSvgThumbnail, viewModel.SVGThumbnailIsEnabled);
            Assert.AreEqual(originalSettings.Properties.EnablePdfThumbnail, viewModel.PDFThumbnailIsEnabled);
            Assert.AreEqual(originalSettings.Properties.EnableGcodeThumbnail, viewModel.GCODEThumbnailIsEnabled);

            // Verify that the stub file was used
            var expectedCallCount = 2;  // once via the view model, and once by the test (GetSettings<T>)

            BackCompatTestProperties.VerifyModuleIOProviderWasRead(fileMock, PowerPreviewSettings.ModuleName, expectedCallCount);
        }
        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);
        }
예제 #6
0
        public void OriginalFilesModificationTest(string version, string fileName)
        {
            var settingPathMock   = new Mock <ISettingsPath>();
            var mockIOProvider    = BackCompatTestProperties.GetModuleIOProvider(version, ShortcutGuideSettings.ModuleName, fileName);
            var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object, settingPathMock.Object);
            ShortcutGuideSettings originalSettings = mockSettingsUtils.GetSettings <ShortcutGuideSettings>(ShortcutGuideSettings.ModuleName);

            var             mockGeneralIOProvider      = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
            var             mockGeneralSettingsUtils   = new SettingsUtils(mockGeneralIOProvider.Object, settingPathMock.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);

            // Verify 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);
        }
예제 #7
0
        public void OriginalFilesModificationTest(string version, string fileName)
        {
            var settingPathMock = new Mock <ISettingsPath>();

            var fileMock          = BackCompatTestProperties.GetModuleIOProvider(version, FancyZonesSettings.ModuleName, fileName);
            var mockSettingsUtils = new SettingsUtils(fileMock.Object, settingPathMock.Object);
            FancyZonesSettings originalSettings = mockSettingsUtils.GetSettingsOrDefault <FancyZonesSettings>(FancyZonesSettings.ModuleName);

            var             mockGeneralIOProvider    = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
            var             mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object, settingPathMock.Object);
            GeneralSettings originalGeneralSettings  = mockGeneralSettingsUtils.GetSettingsOrDefault <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(mockSettingsUtils, generalSettingsRepository, fancyZonesRepository, ColorPickerIsEnabledByDefault_IPC);

            // Verify 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.FancyzonesWindowSwitching.Value, viewModel.WindowSwitching);
            Assert.AreEqual(originalSettings.Properties.FancyzonesNextTabHotkey.Value.ToString(), viewModel.NextTabHotkey.ToString());
            Assert.AreEqual(originalSettings.Properties.FancyzonesPrevTabHotkey.Value.ToString(), viewModel.PrevTabHotkey.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);
            Assert.AreEqual(originalSettings.Properties.FancyzonesAllowPopupWindowSnap.Value, viewModel.AllowPopupWindowSnap);
            Assert.AreEqual(originalSettings.Properties.FancyzonesAllowChildWindowSnap.Value, viewModel.AllowChildWindowSnap);
            Assert.AreEqual(originalSettings.Properties.FancyzonesDisableRoundCornersOnSnap.Value, viewModel.DisableRoundCornersOnWindowSnap);

            // Verify that the stub file was used
            var expectedCallCount = 2;  // once via the view model, and once by the test (GetSettings<T>)

            BackCompatTestProperties.VerifyModuleIOProviderWasRead(fileMock, FancyZonesSettings.ModuleName, expectedCallCount);
            BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
        }