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); }
public void OnActivate_WhenDaemonIsInstalled_ControlsAreConfiguredFromSettings1() { // Daemon is installed so the settings as supplied should be used var settings = new ConfigurableSonarLintSettings { DaemonLogLevel = DaemonLogLevel.Verbose, IsActivateMoreEnabled = true, SkipActivateMoreDialog = true }; var daemonMock = new Mock <ISonarLintDaemon>(); var installerMock = new Mock <IDaemonInstaller>(); installerMock.Setup <bool>(x => x.IsInstalled()).Returns(true); GeneralOptionsDialogPageTestable page = new GeneralOptionsDialogPageTestable(); ConfigureSiteMock(page, settings, daemonMock.Object, installerMock.Object); // Act page.ActivateAccessor(); // Assert page.Control.Should().NotBeNull(); page.Control.DaemonVerbosity.SelectedItem.Should().Be(DaemonLogLevel.Verbose); // Daemon is activate, so deactivate options should be visible page.Control.DeactivateButton.Visibility.Should().Be(Visibility.Visible); page.Control.DeactivateText.Visibility.Should().Be(Visibility.Visible); page.Control.VerbosityPanel.Visibility.Should().Be(Visibility.Visible); // ... and active options should not page.Control.ActivateButton.Visibility.Should().Be(Visibility.Collapsed); page.Control.ActivateText.Visibility.Should().Be(Visibility.Collapsed); }
public void OnActivate_ControlsAreConfigured() { var settings = new ConfigurableSonarLintSettings { DaemonLogLevel = DaemonLogLevel.Verbose, IsActivateMoreEnabled = true, }; GeneralOptionsDialogPageTestable page = new GeneralOptionsDialogPageTestable(); ConfigureSiteMock(page, settings); // Act page.ActivateAccessor(); // Assert page.Control.Should().NotBeNull(); page.Control.DaemonVerbosity.SelectedItem.Should().Be(DaemonLogLevel.Verbose); page.Control.VerbosityPanel.Visibility.Should().Be(Visibility.Visible); }
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); }
public void OnActivate_ControlsAreConfiguredFromSettings2() { var settings = new ConfigurableSonarLintSettings { DaemonLogLevel = DaemonLogLevel.Info, IsActivateMoreEnabled = true, SkipActivateMoreDialog = true }; var daemonMock = new Mock <ISonarLintDaemon>(); GeneralOptionsDialogPageTestable page = new GeneralOptionsDialogPageTestable(); ConfigureSiteMock(page, settings, daemonMock.Object); // Act page.ActivateAccessor(); // Assert page.Control.Should().NotBeNull(); page.Control.DaemonVerbosity.SelectedItem.Should().Be(DaemonLogLevel.Info); }
public void OnActivate_WhenDaemonIsNotInstalled_ControlsAreConfiguredForActivation() { // Daemon is not installed so the control should be set up so the user // can "Activate" var settings = new ConfigurableSonarLintSettings { DaemonLogLevel = DaemonLogLevel.Verbose, IsActivateMoreEnabled = true, SkipActivateMoreDialog = true }; var daemonMock = new Mock <ISonarLintDaemon>(); daemonMock.SetupGet <bool>(x => x.IsInstalled).Returns(false); GeneralOptionsDialogPageTestable page = new GeneralOptionsDialogPageTestable(); ConfigureSiteMock(page, settings, daemonMock.Object); // Act page.ActivateAccessor(); // Assert page.Control.Should().NotBeNull(); page.Control.DaemonVerbosity.SelectedItem.Should().Be(DaemonLogLevel.Verbose); // Daemon is not installed, so deactivate options should not be visible page.Control.DeactivateButton.Visibility.Should().Be(Visibility.Collapsed); page.Control.DeactivateText.Visibility.Should().Be(Visibility.Collapsed); page.Control.VerbosityPanel.Visibility.Should().Be(Visibility.Collapsed); // ... and activate options should be visible page.Control.ActivateButton.Visibility.Should().Be(Visibility.Visible); page.Control.ActivateText.Visibility.Should().Be(Visibility.Visible); page.Control.ShowAdditionalLanguageDownloadDialogue.IsChecked.Should().BeFalse(); page.Control.ShowAdditionalLanguageDownloadText.Visibility.Should().Be(Visibility.Visible); }
public void OnActivate_WhenDaemonIsNotInstalled_ControlsAreConfiguredForActivation() { // Daemon is not installed. However, that should not affect the activation // status of the controls. var settings = new ConfigurableSonarLintSettings { DaemonLogLevel = DaemonLogLevel.Verbose, IsActivateMoreEnabled = true, SkipActivateMoreDialog = true }; var daemonMock = new Mock <ISonarLintDaemon>(); var installerMock = new Mock <IDaemonInstaller>(); installerMock.Setup <bool>(x => x.IsInstalled()).Returns(false); GeneralOptionsDialogPageTestable page = new GeneralOptionsDialogPageTestable(); ConfigureSiteMock(page, settings, daemonMock.Object, installerMock.Object); // Act page.ActivateAccessor(); // Assert page.Control.Should().NotBeNull(); page.Control.DaemonVerbosity.SelectedItem.Should().Be(DaemonLogLevel.Verbose); // User has enabled activation; the activation status of the daemon should be irrelevant page.Control.DeactivateButton.Visibility.Should().Be(Visibility.Visible); page.Control.DeactivateText.Visibility.Should().Be(Visibility.Visible); page.Control.VerbosityPanel.Visibility.Should().Be(Visibility.Visible); // ... and activate options should be visible page.Control.ActivateButton.Visibility.Should().Be(Visibility.Collapsed); page.Control.ActivateText.Visibility.Should().Be(Visibility.Collapsed); }