public void OnApply_Save_SettingsAreUpdated()
        {
            var settings = new ConfigurableSonarLintSettings()
            {
                DaemonLogLevel         = DaemonLogLevel.Verbose,
                IsActivateMoreEnabled  = true,
                SkipActivateMoreDialog = true
            };

            var daemonMock    = new Mock <ISonarLintDaemon>();
            var installerMock = new Mock <IDaemonInstaller>();

            GeneralOptionsDialogPageTestable page = new GeneralOptionsDialogPageTestable();

            ConfigureSiteMock(page, settings, daemonMock.Object, installerMock.Object);
            page.ActivateAccessor();

            page.Control.DaemonVerbosity.SelectedItem = DaemonLogLevel.Minimal;

            // Act
            page.ApplyAccessor(Microsoft.VisualStudio.Shell.DialogPage.ApplyKind.Apply);

            // Assert
            settings.DaemonLogLevel.Should().Be(DaemonLogLevel.Minimal);
        }
Exemple #2
0
        public void OnApply_Cancel_SettingsAreNotUpdated()
        {
            var settings = new ConfigurableSonarLintSettings()
            {
                DaemonLogLevel        = DaemonLogLevel.Verbose,
                IsActivateMoreEnabled = true,
            };

            GeneralOptionsDialogPageTestable page = new GeneralOptionsDialogPageTestable();

            ConfigureSiteMock(page, settings);
            page.ActivateAccessor();

            page.Control.DaemonVerbosity.SelectedItem = DaemonLogLevel.Minimal;

            // Act
            page.ApplyAccessor(Microsoft.VisualStudio.Shell.DialogPage.ApplyKind.Cancel);

            // Assert
            settings.DaemonLogLevel.Should().Be(DaemonLogLevel.Verbose);
        }