public void TestInit() { KnownUIContextsAccessor.Reset(); this.serviceProvider = new ConfigurableServiceProvider(); this.teamExplorerController = new ConfigurableTeamExplorerController(); this.infoBarManager = new ConfigurableInfoBarManager(); IComponentModel componentModel = ConfigurableComponentModel.CreateWithExports( new Export[] { MefTestHelpers.CreateExport<ITeamExplorerController>(this.teamExplorerController), MefTestHelpers.CreateExport<IInfoBarManager>(this.infoBarManager), }); this.serviceProvider.RegisterService(typeof(SComponentModel), componentModel); this.solutionBindingInformationProvider = new ConfigurableSolutionBindingInformationProvider(); this.serviceProvider.RegisterService(typeof(ISolutionBindingInformationProvider), this.solutionBindingInformationProvider); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.solutionBindingSerializer = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(Persistence.ISolutionBindingSerializer), this.solutionBindingSerializer); this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher); this.stateManager = (ConfigurableStateManager)this.host.VisualStateManager; }
public void TestInitialize() { this.serviceProvider = new ConfigurableServiceProvider(false); this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher); var mefExport1 = MefTestHelpers.CreateExport <IHost>(this.host); this.activeSolutionTracker = new ConfigurableActiveSolutionTracker(); var mefExport2 = MefTestHelpers.CreateExport <IActiveSolutionTracker>(this.activeSolutionTracker); var mefModel = ConfigurableComponentModel.CreateWithExports(mefExport1, mefExport2); this.serviceProvider.RegisterService(typeof(SComponentModel), mefModel, replaceExisting: true); this.solutionMock = new SolutionMock(); this.serviceProvider.RegisterService(typeof(SVsSolution), this.solutionMock); this.errorListController = new ConfigurableErrorListInfoBarController(); this.serviceProvider.RegisterService(typeof(IErrorListInfoBarController), this.errorListController); this.solutionBindingInformationProvider = new ConfigurableSolutionBindingInformationProvider(); this.serviceProvider.RegisterService(typeof(ISolutionBindingInformationProvider), this.solutionBindingInformationProvider); this.solutionBindingSerializer = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), solutionBindingSerializer); this.sonarLintOutputMock = new Mock <ISonarLintOutput>(); }
public void TestInit() { this.serviceProvider = new ConfigurableServiceProvider(); this.projectHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectHelper); this.ruleSetInfoProvider = new ConfigurableSolutionRuleSetsInformationProvider(); this.ruleSetInfoProvider.SolutionRootFolder = this.TestContext.TestRunDirectory; this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetInfoProvider); this.fileSystem = new ConfigurableFileSystem(); this.serviceProvider.RegisterService(typeof(IFileSystem), this.fileSystem); this.solutionBinding = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), this.solutionBinding); this.inspector = new ConfigurableRuleSetInspector(); this.serviceProvider.RegisterService(typeof(IRuleSetInspector), this.inspector); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.dte = new DTEMock(); this.projectHelper.CurrentActiveSolution = new SolutionMock(dte); }
public void TestInitialize() { this.serviceProvider = new ConfigurableServiceProvider(); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.sonarQubeService = new ConfigurableSonarQubeServiceWrapper(); this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); var sccFileSystem = new ConfigurableSourceControlledFileSystem(); var ruleSerializer = new ConfigurableRuleSetSerializer(sccFileSystem); var solutionBinding = new ConfigurableSolutionBindingSerializer(); this.settings = new ConfigurableIntegrationSettings { AllowNuGetPackageInstall = true }; var mefExports = MefTestHelpers.CreateExport <IIntegrationSettings>(settings); var mefModel = ConfigurableComponentModel.CreateWithExports(mefExports); this.serviceProvider.RegisterService(typeof(SComponentModel), mefModel); this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), sccFileSystem); this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), ruleSerializer); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), solutionBinding); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper); }
public void TestInit() { KnownUIContextsAccessor.Reset(); this.serviceProvider = new ConfigurableServiceProvider(); this.teamExplorerController = new ConfigurableTeamExplorerController(); this.infoBarManager = new ConfigurableInfoBarManager(); IComponentModel componentModel = ConfigurableComponentModel.CreateWithExports( new Export[] { MefTestHelpers.CreateExport <ITeamExplorerController>(this.teamExplorerController), MefTestHelpers.CreateExport <IInfoBarManager>(this.infoBarManager), }); this.serviceProvider.RegisterService(typeof(SComponentModel), componentModel); this.solutionBindingInformationProvider = new ConfigurableSolutionBindingInformationProvider(); this.serviceProvider.RegisterService(typeof(ISolutionBindingInformationProvider), this.solutionBindingInformationProvider); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.solutionBindingSerializer = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(Persistence.ISolutionBindingSerializer), this.solutionBindingSerializer); this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher); this.stateManager = (ConfigurableStateManager)this.host.VisualStateManager; }
public void TestInit() { this.serviceProvider = new ConfigurableServiceProvider(); this.projectHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectHelper); this.ruleSetInfoProvider = new ConfigurableSolutionRuleSetsInformationProvider(); this.ruleSetInfoProvider.SolutionRootFolder = this.TestContext.TestRunDirectory; this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetInfoProvider); this.fileSystem = new ConfigurableFileSystem(); this.serviceProvider.RegisterService(typeof(IFileSystem), this.fileSystem); this.solutionBinding = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), this.solutionBinding); this.inspector = new ConfigurableRuleSetInspector(); this.serviceProvider.RegisterService(typeof(IRuleSetInspector), this.inspector); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.dte = new DTEMock(); this.projectHelper.CurrentActiveSolution = new SolutionMock(dte); }
public void Ctor_InvalidArgs_NullLegacySerializer_Throws() { // Arrange var serializer = new ConfigurableSolutionBindingSerializer(); Action act = () => new ConfigurationProvider(null, serializer); // Act & Assert act.Should().ThrowExactly <ArgumentNullException>().And.ParamName.Should().Be("legacySerializer"); }
public void Ctor_InvalidArgs_NullConnectedModeSerializer_Throws() { // Arrange var serializer = new ConfigurableSolutionBindingSerializer(); Action act = () => new ConfigurationProvider(serializer, null); // Act & Assert act.ShouldThrow <ArgumentNullException>().And.ParamName.Should().Be("wrappedProvider"); }
public void TestInitialize() { legacySerializer = new ConfigurableSolutionBindingSerializer { CurrentBinding = null }; newSerializer = new ConfigurableConfigurationProvider { ModeToReturn = SonarLintMode.Standalone }; testSubject = new ConfigurationProvider(legacySerializer, newSerializer); }
public void TestInitialize() { legacySerializer = new ConfigurableSolutionBindingSerializer { CurrentBinding = null }; newSerializer = new ConfigurableSolutionBindingSerializer { CurrentBinding = null }; testSubject = new ConfigurationProvider(legacySerializer, newSerializer); }
public void TestInit() { this.serviceProvider = new ConfigurableServiceProvider(); this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher); this.projectSystem = new ConfigurableVsProjectSystemHelper(this.serviceProvider); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystem); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.bindingSerializer = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), this.bindingSerializer); }
public void TestInit() { this.serviceProvider = new ConfigurableServiceProvider(); this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher); this.projectSystem = new ConfigurableVsProjectSystemHelper(this.serviceProvider); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystem); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.bindingSerializer = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), this.bindingSerializer); }
public void TestInit() { this.serviceProvider = new ConfigurableServiceProvider(); this.bindingSerializer = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(Persistence.ISolutionBindingSerializer), this.bindingSerializer); this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper); this.ruleSetInfoProvider = new ConfigurableSolutionRuleSetsInformationProvider(); this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetInfoProvider); this.ruleSetSerializer = new ConfigurableRuleSetSerializer(); this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), this.ruleSetSerializer); }
public void TestInit() { this.serviceProvider = new ConfigurableServiceProvider(); this.bindingSerializer = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(Persistence.ISolutionBindingSerializer), this.bindingSerializer); this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper); this.ruleSetInfoProvider = new ConfigurableSolutionRuleSetsInformationProvider(); this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetInfoProvider); this.ruleSetSerializer = new ConfigurableRuleSetSerializer(); this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), this.ruleSetSerializer); }
public void TestInitialize() { this.serviceProvider = new ConfigurableServiceProvider(); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.sonarQubeService = new ConfigurableSonarQubeServiceWrapper(); this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); var sccFileSystem = new ConfigurableSourceControlledFileSystem(); var ruleSerializer = new ConfigurableRuleSetSerializer(sccFileSystem); var solutionBinding = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), sccFileSystem); this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), ruleSerializer); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), solutionBinding); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper); }
public void TestInitialize() { this.serviceProvider = new ConfigurableServiceProvider(); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.sonarQubeServiceMock = new Mock <ISonarQubeService>(); this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); var sccFileSystem = new ConfigurableSourceControlledFileSystem(); var ruleSerializer = new ConfigurableRuleSetSerializer(sccFileSystem); var solutionBinding = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), sccFileSystem); this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), ruleSerializer); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), solutionBinding); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper); this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher); }
public void ActiveSolutionBoundTracker_Changes() { var solutionBinding = new ConfigurableSolutionBindingSerializer { CurrentBinding = new BoundSonarQubeProject() }; this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), solutionBinding); this.solutionBindingInformationProvider.SolutionBound = true; var testSubject = new ActiveSolutionBoundTracker(this.host, this.activeSolutionTracker); var reanalysisEventCalledCount = 0; testSubject.SolutionBindingChanged += (obj, args) => { reanalysisEventCalledCount++; }; // Sanity testSubject.IsActiveSolutionBound.Should().BeTrue("Initially bound"); this.errorListController.RefreshCalledCount.Should().Be(1); this.errorListController.ResetCalledCount.Should().Be(0); reanalysisEventCalledCount.Should().Be(0, "No reanalysis forced"); // Case 1: Clear bound project solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = false; // Act host.VisualStateManager.ClearBoundProject(); // Assert testSubject.IsActiveSolutionBound.Should().BeFalse("Unbound solution should report false activation"); this.errorListController.RefreshCalledCount.Should().Be(1); this.errorListController.ResetCalledCount.Should().Be(0); reanalysisEventCalledCount.Should().Be(1, "Unbind should trigger reanalysis"); // Case 2: Set bound project solutionBinding.CurrentBinding = new BoundSonarQubeProject(); this.solutionBindingInformationProvider.SolutionBound = true; // Act host.VisualStateManager.SetBoundProject(new ProjectInformation()); // Assert testSubject.IsActiveSolutionBound.Should().BeTrue("Bound solution should report true activation"); this.errorListController.RefreshCalledCount.Should().Be(1); this.errorListController.ResetCalledCount.Should().Be(0); reanalysisEventCalledCount.Should().Be(2, "Bind should trigger reanalysis"); // Case 3: Solution unloaded solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = false; // Act activeSolutionTracker.SimulateActiveSolutionChanged(); // Assert testSubject.IsActiveSolutionBound.Should().BeFalse("Should respond to solution change event and report unbound"); this.errorListController.RefreshCalledCount.Should().Be(2); this.errorListController.ResetCalledCount.Should().Be(0); reanalysisEventCalledCount.Should().Be(3, "Solution change should trigger reanalysis"); // Case 4: Solution loaded solutionBinding.CurrentBinding = new BoundSonarQubeProject(); this.solutionBindingInformationProvider.SolutionBound = true; // Act activeSolutionTracker.SimulateActiveSolutionChanged(); // Assert testSubject.IsActiveSolutionBound.Should().BeTrue("Bound respond to solution change event and report bound"); this.errorListController.RefreshCalledCount.Should().Be(3); this.errorListController.ResetCalledCount.Should().Be(0); reanalysisEventCalledCount.Should().Be(4, "Solution change should trigger reanalysis"); // Case 5: Dispose and change // Act testSubject.Dispose(); solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = true; host.VisualStateManager.ClearBoundProject(); // Assert reanalysisEventCalledCount.Should().Be(4, "Once disposed should stop raising the event"); this.errorListController.RefreshCalledCount.Should().Be(3); this.errorListController.ResetCalledCount.Should().Be(1); }
public void ActiveSolutionBoundTracker_Changes() { var boundProject = new BoundSonarQubeProject(new Uri("http://localhost:9000"), "key"); var solutionBinding = new ConfigurableSolutionBindingSerializer(); bool serviceIsConnected = false; var mockSqService = new Mock <ISonarQubeService>(); Expression <Func <ISonarQubeService, Task> > connectMethod = x => x.ConnectAsync(It.IsAny <ConnectionInformation>(), It.IsAny <CancellationToken>()); Expression <Action <ISonarQubeService> > disconnectMethod = x => x.Disconnect(); mockSqService.SetupGet(x => x.IsConnected).Returns(() => serviceIsConnected); mockSqService.Setup(disconnectMethod).Callback(() => serviceIsConnected = false).Verifiable(); mockSqService.Setup(connectMethod) .Returns(Task.Delay(0)) .Callback(() => serviceIsConnected = true).Verifiable(); this.host.SonarQubeService = mockSqService.Object; this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), solutionBinding); solutionBinding.CurrentBinding = boundProject; this.solutionBindingInformationProvider.SolutionBound = true; var testSubject = new ActiveSolutionBoundTracker(this.host, this.activeSolutionTracker); var solutionBindingChangedEventCount = 0; testSubject.SolutionBindingChanged += (obj, args) => { solutionBindingChangedEventCount++; }; // Sanity testSubject.IsActiveSolutionBound.Should().BeTrue("Initially bound"); // TODO: this.errorListController.RefreshCalledCount.Should().Be(1); this.errorListController.ResetCalledCount.Should().Be(0); solutionBindingChangedEventCount.Should().Be(0, "no events raised during construction"); // Case 1: Clear bound project solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = false; // Act host.VisualStateManager.ClearBoundProject(); // Assert testSubject.IsActiveSolutionBound.Should().BeFalse("Unbound solution should report false activation"); // TODO: this.errorListController.RefreshCalledCount.Should().Be(1); this.errorListController.ResetCalledCount.Should().Be(0); solutionBindingChangedEventCount.Should().Be(1, "Unbind should trigger reanalysis"); // Connect not called // Disconnect not called mockSqService.Verify(disconnectMethod, Times.Never); mockSqService.Verify(connectMethod, Times.Never); // Case 2: Set bound project solutionBinding.CurrentBinding = boundProject; this.solutionBindingInformationProvider.SolutionBound = true; // Act host.VisualStateManager.SetBoundProject(new SonarQubeProject("", "")); // Assert testSubject.IsActiveSolutionBound.Should().BeTrue("Bound solution should report true activation"); // TODO: this.errorListController.RefreshCalledCount.Should().Be(1); this.errorListController.ResetCalledCount.Should().Be(0); solutionBindingChangedEventCount.Should().Be(2, "Bind should trigger reanalysis"); // Notifications from the Team Explorer should not trigger connect/disconnect mockSqService.Verify(disconnectMethod, Times.Never); mockSqService.Verify(connectMethod, Times.Never); // Case 3: Solution unloaded solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = false; // Act activeSolutionTracker.SimulateActiveSolutionChanged(); // Assert testSubject.IsActiveSolutionBound.Should().BeFalse("Should respond to solution change event and report unbound"); // TODO: this.errorListController.RefreshCalledCount.Should().Be(2); this.errorListController.ResetCalledCount.Should().Be(0); solutionBindingChangedEventCount.Should().Be(3, "Solution change should trigger reanalysis"); // Closing an unbound solution should not call disconnect/connect mockSqService.Verify(disconnectMethod, Times.Never); mockSqService.Verify(connectMethod, Times.Never); // Case 4: Load a bound solution solutionBinding.CurrentBinding = boundProject; this.solutionBindingInformationProvider.SolutionBound = true; // Act activeSolutionTracker.SimulateActiveSolutionChanged(); // Assert testSubject.IsActiveSolutionBound.Should().BeTrue("Bound respond to solution change event and report bound"); // TODO: this.errorListController.RefreshCalledCount.Should().Be(3); this.errorListController.ResetCalledCount.Should().Be(0); solutionBindingChangedEventCount.Should().Be(4, "Solution change should trigger reanalysis"); // Loading a bound solution should call connect mockSqService.Verify(disconnectMethod, Times.Never); mockSqService.Verify(connectMethod, Times.Exactly(1)); // Case 5: Close a bound solution solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = false; // Act activeSolutionTracker.SimulateActiveSolutionChanged(); // Assert // TODO: this.errorListController.RefreshCalledCount.Should().Be(4); this.errorListController.ResetCalledCount.Should().Be(0); solutionBindingChangedEventCount.Should().Be(5, "Solution change should trigger reanalysis"); // Closing a bound solution should call disconnect mockSqService.Verify(disconnectMethod, Times.Exactly(1)); mockSqService.Verify(connectMethod, Times.Exactly(1)); // Case 6: Dispose and change // Act testSubject.Dispose(); solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = true; host.VisualStateManager.ClearBoundProject(); // Assert solutionBindingChangedEventCount.Should().Be(5, "Once disposed should stop raising the event"); // TODO: this.errorListController.RefreshCalledCount.Should().Be(3); this.errorListController.ResetCalledCount.Should().Be(1); mockSqService.Verify(disconnectMethod, Times.Exactly(1)); mockSqService.Verify(connectMethod, Times.Exactly(1)); }
public void ActiveSolutionBoundTracker_Changes() { var solutionBinding = new ConfigurableSolutionBindingSerializer { CurrentBinding = new BoundSonarQubeProject() }; this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), solutionBinding); this.solutionBindingInformationProvider.SolutionBound = true; var testSubject = new ActiveSolutionBoundTracker(this.host, this.activeSolutionTracker); var reanalysisEventCalledCount = 0; testSubject.SolutionBindingChanged += (obj, args) => { reanalysisEventCalledCount++; }; // Sanity Assert.IsTrue(testSubject.IsActiveSolutionBound, "Initially bound"); this.errorListController.AssertRefreshCalled(1); this.errorListController.AssertResetCalled(0); Assert.AreEqual(0, reanalysisEventCalledCount, "No reanalysis forced"); // Case 1: Clear bound project solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = false; // Act host.VisualStateManager.ClearBoundProject(); // Verify Assert.IsFalse(testSubject.IsActiveSolutionBound, "Unbound solution should report false activation"); this.errorListController.AssertRefreshCalled(1); this.errorListController.AssertResetCalled(0); Assert.AreEqual(1, reanalysisEventCalledCount, "Unbind should trigger reanalysis"); // Case 2: Set bound project solutionBinding.CurrentBinding = new BoundSonarQubeProject(); this.solutionBindingInformationProvider.SolutionBound = true; // Act host.VisualStateManager.SetBoundProject(new ProjectInformation()); // Verify Assert.IsTrue(testSubject.IsActiveSolutionBound, "Bound solution should report true activation"); this.errorListController.AssertRefreshCalled(1); this.errorListController.AssertResetCalled(0); Assert.AreEqual(2, reanalysisEventCalledCount, "Bind should trigger reanalysis"); // Case 3: Solution unloaded solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = false; // Act activeSolutionTracker.SimulateActiveSolutionChanged(); // Verify Assert.IsFalse(testSubject.IsActiveSolutionBound, "Should respond to solution change event and report unbound"); this.errorListController.AssertRefreshCalled(2); this.errorListController.AssertResetCalled(0); Assert.AreEqual(3, reanalysisEventCalledCount, "Solution change should trigger reanalysis"); // Case 4: Solution loaded solutionBinding.CurrentBinding = new BoundSonarQubeProject(); this.solutionBindingInformationProvider.SolutionBound = true; // Act activeSolutionTracker.SimulateActiveSolutionChanged(); // Verify Assert.IsTrue(testSubject.IsActiveSolutionBound, "Bound respond to solution change event and report bound"); this.errorListController.AssertRefreshCalled(3); this.errorListController.AssertResetCalled(0); Assert.AreEqual(4, reanalysisEventCalledCount, "Solution change should trigger reanalysis"); // Case 5: Dispose and change // Act testSubject.Dispose(); solutionBinding.CurrentBinding = null; this.solutionBindingInformationProvider.SolutionBound = true; host.VisualStateManager.ClearBoundProject(); // Verify Assert.AreEqual(4, reanalysisEventCalledCount, "Once disposed should stop raising the event"); this.errorListController.AssertRefreshCalled(3); this.errorListController.AssertResetCalled(1); }