public void GetSuppressedIssues_SolutionBindingIsStandalone_EmptyList(SolutionBindingEventType eventType) { SimulateBindingEvent(eventType, BindingConfiguration.Standalone); var actual = testSubject.GetSuppressedIssues("project guid", "file path"); actual.Should().BeEmpty(); }
public void SolutionBindingEvent_Connected_SuppressionsEventRaised(SolutionBindingEventType eventType, SonarLintMode mode) { var eventMock = new Mock <EventHandler>(); testSubject.SuppressionsUpdateRequested += eventMock.Object; var configuration = new BindingConfiguration(new BoundSonarQubeProject(), mode, null); SimulateBindingEvent(eventType, configuration); eventMock.Verify(x => x(testSubject, EventArgs.Empty), Times.Once); }
public void SolutionBindingEvent_Standalone_SuppressionsEventNotRaised(SolutionBindingEventType eventType) { var eventMock = new Mock <EventHandler>(); testSubject.SuppressionsUpdateRequested += eventMock.Object; var configuration = new BindingConfiguration(new BoundSonarQubeProject(), SonarLintMode.Standalone, null); SimulateBindingEvent(eventType, configuration); eventMock.VerifyNoOtherCalls(); }
private void SimulateBindingEvent(SolutionBindingEventType eventType, BindingConfiguration newConfiguration) { if (eventType == SolutionBindingEventType.SolutionBindingUpdated) { activeSolutionBoundTracker.CurrentConfiguration = newConfiguration; activeSolutionBoundTracker.SimulateSolutionBindingUpdated(); } else { activeSolutionBoundTracker.SimulateSolutionBindingChanged( new ActiveSolutionBindingEventArgs(newConfiguration)); } }
public void SolutionBindingEvent_PreviousProviderIsDisposed(SolutionBindingEventType eventType, SonarLintMode mode) { var firstProvider = new Mock <ISonarQubeIssuesProvider>(); var firstConfiguration = new BindingConfiguration(new BoundSonarQubeProject(), SonarLintMode.Connected, null); createProviderFunc .Setup(x => x(firstConfiguration)) .Returns(firstProvider.Object); SimulateBindingEvent(eventType, firstConfiguration); firstProvider.Verify(x => x.Dispose(), Times.Never); var secondConfiguration = new BindingConfiguration(new BoundSonarQubeProject(), mode, null); SimulateBindingEvent(eventType, secondConfiguration); firstProvider.Verify(x => x.Dispose(), Times.Once); }
public void SolutionBindingEvent_Standalone_SonarQubeIssuesProviderNotCreated(SolutionBindingEventType eventType) { var configuration = new BindingConfiguration(new BoundSonarQubeProject(), SonarLintMode.Standalone, null); SimulateBindingEvent(eventType, configuration); createProviderFunc.VerifyNoOtherCalls(); }
public void GetSuppressedIssues_SolutionBindingIsConnected_ListFromSonarQubeIssuesProvider(SolutionBindingEventType eventType, SonarLintMode mode) { var bindingConfiguration = new BindingConfiguration(new BoundSonarQubeProject(), mode, null); var expectedIssues = SetupExpectedIssues(bindingConfiguration); SimulateBindingEvent(eventType, bindingConfiguration); var actual = testSubject.GetSuppressedIssues("project guid", "file path"); actual.Should().BeEquivalentTo(expectedIssues); }
public void GetSuppressedIssues_SolutionBindingIsStandalone_SonarQubeIssuesProviderNotCreated(SolutionBindingEventType eventType) { SimulateBindingEvent(eventType, BindingConfiguration.Standalone); testSubject.GetSuppressedIssues("project guid", "file path"); createProviderFunc.Verify(x => x(It.IsAny <BindingConfiguration>()), Times.Never); }