Exemplo n.º 1
0
        public void SonarAnalyzerManager_Triggers_SolutionBindingChanged_ReanalyzeSolution()
        {
            ConfigurableHost host       = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher);
            Export           mefExport1 = MefTestHelpers.CreateExport <IHost>(host);

            ConfigurableActiveSolutionBoundTracker activeSolutionBoundTracker = new ConfigurableActiveSolutionBoundTracker();
            Export mefExport2 = MefTestHelpers.CreateExport <IActiveSolutionBoundTracker>(activeSolutionBoundTracker);

            IComponentModel mefModel = ConfigurableComponentModel.CreateWithExports(mefExport1, mefExport2);

            this.serviceProvider.RegisterService(typeof(SComponentModel), mefModel);

            ConfigurableSolutionAnalysisRequester solutionAnalysisRequester = new ConfigurableSolutionAnalysisRequester();

            using (new SonarAnalyzerManager(this.serviceProvider, new AdhocWorkspace(), solutionAnalysisRequester))
            {
                // Sanity
                Assert.AreEqual(0, solutionAnalysisRequester.ReanalyzeSolutionCallCount);

                // Act
                activeSolutionBoundTracker.SimulateSolutionBindingChanged(true);

                // Verify
                Assert.AreEqual(1, solutionAnalysisRequester.ReanalyzeSolutionCallCount);
            }
        }
        public void TestInitialize()
        {
            createProviderFunc         = new Mock <SuppressedIssuesProvider.CreateProviderFunc>();
            activeSolutionBoundTracker = new ConfigurableActiveSolutionBoundTracker();
            activeSolutionBoundTracker.CurrentConfiguration = BindingConfiguration.Standalone;

            testSubject = new SuppressedIssuesProvider(activeSolutionBoundTracker, createProviderFunc.Object);
        }
Exemplo n.º 3
0
            public TestEnvironmentBuilder(SonarLintMode bindingMode)
            {
                analysisRequesterMock       = new Mock <IAnalysisRequester>();
                userSettingsProviderMock    = new Mock <IUserSettingsProvider>();
                suppressedIssuesMonitorMock = new Mock <ISuppressedIssuesMonitor>();

                var solutionBoundTracker = new ConfigurableActiveSolutionBoundTracker
                {
                    CurrentConfiguration = new BindingConfiguration(new BoundSonarQubeProject(), bindingMode, null)
                };

                Logger = new TestLogger();

                TestSubject = new AnalysisConfigMonitor(analysisRequesterMock.Object,
                                                        userSettingsProviderMock.Object, solutionBoundTracker, suppressedIssuesMonitorMock.Object, Logger);
            }
Exemplo n.º 4
0
            public TestEnvironmentBuilder(SonarLintMode mode)
            {
                standaloneSettingsProviderMock = new Mock <IUserSettingsProvider>();
                fileWrapperMock = new Mock <IFile>();
                Logger          = new TestLogger();

                sonarWayProviderMock       = new Mock <ICFamilyRulesConfigProvider>();
                activeSolutionBoundTracker = new ConfigurableActiveSolutionBoundTracker();
                rulesetInfoProviderMock    = new Mock <ISolutionRuleSetsInformationProvider>();

                // Register the local services
                host = new Mock <IHost>();
                host.Setup(x => x.GetService(typeof(ISolutionRuleSetsInformationProvider))).Returns(rulesetInfoProviderMock.Object);

                bindingMode = mode;
            }
            public TestEnvironmentBuilder(SonarLintMode bindingMode)
            {
                this.bindingMode = bindingMode;

                analysisRequesterMock    = new Mock <IAnalysisRequester>();
                userSettingsProviderMock = new Mock <IUserSettingsProvider>();
                solutionBoundTracker     = new ConfigurableActiveSolutionBoundTracker()
                {
                    CurrentConfiguration = new BindingConfiguration(new Persistence.BoundSonarQubeProject(), bindingMode)
                };

                Logger = new TestLogger();

                TestSubject = new AnalysisConfigMonitor(analysisRequesterMock.Object,
                                                        userSettingsProviderMock.Object, solutionBoundTracker, Logger);
            }
        public void TestInitialize()
        {
            this.serviceProvider = new ConfigurableServiceProvider(false);

            this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher);
            this.activeSolutionBoundTracker = new ConfigurableActiveSolutionBoundTracker();
            var outputWindow = new ConfigurableVsOutputWindow();

            var mefExport1 = MefTestHelpers.CreateExport<IHost>(this.host);
            var mefExport2 = MefTestHelpers.CreateExport<IActiveSolutionBoundTracker>(this.activeSolutionBoundTracker);
            var mefModel = ConfigurableComponentModel.CreateWithExports(mefExport1, mefExport2);

            this.serviceProvider.RegisterService(typeof(SComponentModel), mefModel);
            this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow);

            this.testSubject = new SonarAnalyzerManager(this.serviceProvider, new AdhocWorkspace());
        }
Exemplo n.º 7
0
        public void TestInitialize()
        {
            this.serviceProvider = new ConfigurableServiceProvider(false);

            this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher);
            this.activeSolutionBoundTracker = new ConfigurableActiveSolutionBoundTracker();
            var outputWindow = new ConfigurableVsOutputWindow();

            var mefExport1 = MefTestHelpers.CreateExport <IHost>(this.host);
            var mefExport2 = MefTestHelpers.CreateExport <IActiveSolutionBoundTracker>(this.activeSolutionBoundTracker);
            var mefModel   = ConfigurableComponentModel.CreateWithExports(mefExport1, mefExport2);

            this.serviceProvider.RegisterService(typeof(SComponentModel), mefModel);
            this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow);

            this.testSubject = new SonarAnalyzerManager(this.serviceProvider, new AdhocWorkspace());
        }
        public void SonarAnalyzerManager_Triggers_SolutionBindingChanged_ReanalyzeSolution()
        {
            ConfigurableHost host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher);
            Export mefExport1 = MefTestHelpers.CreateExport<IHost>(host);

            ConfigurableActiveSolutionBoundTracker activeSolutionBoundTracker = new ConfigurableActiveSolutionBoundTracker();
            Export mefExport2 = MefTestHelpers.CreateExport<IActiveSolutionBoundTracker>(activeSolutionBoundTracker);

            IComponentModel mefModel = ConfigurableComponentModel.CreateWithExports(mefExport1, mefExport2);
            this.serviceProvider.RegisterService(typeof(SComponentModel), mefModel);

            ConfigurableSolutionAnalysisRequester solutionAnalysisRequester = new ConfigurableSolutionAnalysisRequester();

            using (new SonarAnalyzerManager(this.serviceProvider, new AdhocWorkspace(), solutionAnalysisRequester))
            {
                // Sanity
                Assert.AreEqual(0, solutionAnalysisRequester.ReanalyzeSolutionCallCount);

                // Act
                activeSolutionBoundTracker.SimulateSolutionBindingChanged(true);

                // Verify
                Assert.AreEqual(1, solutionAnalysisRequester.ReanalyzeSolutionCallCount);
            }
        }