public void UpdateConnection_Disconnect_WpfCommandIsAvailableButNotExecutable_ServiceDisconnectedIsCalled() { // If the WPF command is available then it should be used to disconnect, // rather than calling service.Disconnect() directly. // Here, the command exists but is not executable. // Arrange var testSubject = new ActiveSolutionBoundTracker(this.host, this.activeSolutionTracker, loggerMock.Object); int commandCallCount = 0; int commandCanExecuteCallCount = 0; var teSection = ConfigurableSectionController.CreateDefault(); teSection.DisconnectCommand = new Integration.WPF.RelayCommand( () => commandCallCount++, () => { commandCanExecuteCallCount++; return(false); }); host.SetActiveSection(teSection); ConfigureService(isConnected: true); ConfigureSolutionBinding(null); // Act activeSolutionTracker.SimulateActiveSolutionChanged(isSolutionOpen: false); // Assert VerifyServiceConnect(Times.Never()); VerifyServiceDisconnect(Times.Once()); commandCanExecuteCallCount.Should().Be(1); commandCallCount.Should().Be(0); }
public void TestInitialize() { serviceProvider = new ConfigurableServiceProvider(); configProvider = new ConfigurableConfigurationProvider(); configProvider.ProjectToReturn = ValidProject; serviceProvider.RegisterService(typeof(IConfigurationProvider), configProvider); var outputWindow = new ConfigurableVsOutputWindow(); outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); host = new ConfigurableHost(serviceProvider, Dispatcher.CurrentDispatcher); section = new ConfigurableSectionController(); host.SetActiveSection(section); testSubject = new UnbindCommand(host); }