private static TaintIssuesSynchronizer CreateTestSubject(ITaintStore taintStore = null, ITaintIssueToIssueVisualizationConverter converter = null, ILogger logger = null, SonarLintMode mode = SonarLintMode.Connected, ISonarQubeService sonarService = null, IVsMonitorSelection vsMonitor = null, IToolWindowService toolWindowService = null) { taintStore ??= Mock.Of <ITaintStore>(); converter ??= Mock.Of <ITaintIssueToIssueVisualizationConverter>(); var serviceProvider = CreateServiceProvider(vsMonitor); var configurationProvider = new Mock <IConfigurationProvider>(); configurationProvider .Setup(x => x.GetConfiguration()) .Returns(new BindingConfiguration(new BoundSonarQubeProject { ProjectKey = SharedProjectKey }, mode, "")); sonarService ??= CreateSonarService().Object; toolWindowService ??= Mock.Of <IToolWindowService>(); logger ??= Mock.Of <ILogger>(); return(new TaintIssuesSynchronizer(taintStore, sonarService, converter, configurationProvider.Object, toolWindowService, serviceProvider, logger)); }
public TaintIssuesSynchronizer(ITaintStore taintStore, ISonarQubeService sonarQubeService, ITaintIssueToIssueVisualizationConverter converter, IConfigurationProvider configurationProvider, IToolWindowService toolWindowService, [Import(typeof(VSShell.SVsServiceProvider))] IServiceProvider serviceProvider, ILogger logger) { this.taintStore = taintStore; this.sonarQubeService = sonarQubeService; this.converter = converter; this.configurationProvider = configurationProvider; this.toolWindowService = toolWindowService; this.logger = logger; vsMonitorSelection = (VSShellInterop.IVsMonitorSelection)serviceProvider.GetService(typeof(VSShellInterop.SVsShellMonitorSelection)); Guid localGuid = TaintIssuesExistUIContext.Guid; vsMonitorSelection.GetCmdUIContextCookie(ref localGuid, out contextCookie); }