public void WhenUserSettingsChange_StandaloneMode_HasSubscribersToConfigChangedEvent_SubscribersNotified()
        {
            var builder      = new TestEnvironmentBuilder(SonarLintMode.Standalone);
            var eventHandler = new Mock <EventHandler>();

            builder.TestSubject.ConfigChanged += eventHandler.Object;

            builder.SimulateUserSettingsChanged();

            eventHandler.Verify(x => x(builder.TestSubject, EventArgs.Empty), Times.Once);
        }
        public void WhenUserSettingsChange_ConnectedMode_HasSubscribersToConfigChangedEvent_SubscribersNotNotified(SonarLintMode mode)
        {
            var builder      = new TestEnvironmentBuilder(mode);
            var eventHandler = new Mock <EventHandler>();

            builder.TestSubject.ConfigChanged += eventHandler.Object;

            builder.SimulateUserSettingsChanged();

            eventHandler.VerifyNoOtherCalls();
        }
Ejemplo n.º 3
0
        public void WhenDisposed_EventsAreIgnored(SonarLintMode bindingMode)
        {
            var builder = new TestEnvironmentBuilder(bindingMode);

            // Act
            builder.TestSubject.Dispose();

            // Raise events and check they are ignored
            builder.SimulateSuppressionsUpdated();
            builder.SimulateUserSettingsChanged();

            builder.AssertAnalysisIsNotRequested();
        }
Ejemplo n.º 4
0
        public void WhenUserSettingsChange(SonarLintMode bindingMode, bool shouldAnalysisBeRequested)
        {
            var builder = new TestEnvironmentBuilder(bindingMode);

            builder.SimulateUserSettingsChanged();

            if (shouldAnalysisBeRequested)
            {
                builder.AssertAnalysisIsRequested();
                builder.Logger.AssertOutputStringExists(AnalysisStrings.ConfigMonitor_UserSettingsChanged);
            }
            else
            {
                builder.AssertAnalysisIsNotRequested();
                builder.Logger.AssertOutputStringExists(AnalysisStrings.ConfigMonitor_IgnoringUserSettingsChanged);
            }
        }
Ejemplo n.º 5
0
        public void WhenUserSettingsChange_AnalysisIsRequested(SonarLintMode bindingMode)
        {
            var builder = new TestEnvironmentBuilder(bindingMode);

            builder.SimulateUserSettingsChanged();

            // Should always re-analyse
            builder.AssertAnalysisIsRequested();
            builder.Logger.AssertOutputStringExists(AnalysisStrings.ConfigMonitor_UserSettingsChanged);

            if (bindingMode == SonarLintMode.Standalone)
            {
                builder.Logger.AssertOutputStringDoesNotExist(AnalysisStrings.ConfigMonitor_UserSettingsIgnoredForConnectedModeLanguages);
            }
            else
            {
                builder.Logger.AssertOutputStringExists(AnalysisStrings.ConfigMonitor_UserSettingsIgnoredForConnectedModeLanguages);
            }
        }