internal ShowInBrowserService(ISonarQubeService sonarQubeService,
                               IConfigurationProvider configurationProvider,
                               IVsBrowserService vsBrowserService,
                               IRuleHelpLinkProvider ruleHelpLinkProvider)
 {
     this.sonarQubeService      = sonarQubeService;
     this.configurationProvider = configurationProvider;
     this.vsBrowserService      = vsBrowserService;
     this.ruleHelpLinkProvider  = ruleHelpLinkProvider;
 }
Beispiel #2
0
        private NotificationIndicatorViewModel CreateTestSubject(ITimer timer = null,
                                                                 IServerNotificationsTelemetryManager telemetryManager = null,
                                                                 IVsBrowserService vsBrowserService = null)
        {
            timer ??= Mock.Of <ITimer>();
            telemetryManager ??= Mock.Of <IServerNotificationsTelemetryManager>();
            vsBrowserService ??= Mock.Of <IVsBrowserService>();

            return(new NotificationIndicatorViewModel(telemetryManager, vsBrowserService, a => a(), timer));
        }
Beispiel #3
0
        private ShowInBrowserService CreateTestSubject(ISonarQubeService sonarQubeService           = null,
                                                       IConfigurationProvider configurationProvider = null,
                                                       IVsBrowserService browserService             = null,
                                                       IRuleHelpLinkProvider helpLinkProvider       = null)
        {
            sonarQubeService ??= Mock.Of <ISonarQubeService>();
            configurationProvider ??= Mock.Of <IConfigurationProvider>();
            browserService ??= Mock.Of <IVsBrowserService>();
            helpLinkProvider ??= Mock.Of <IRuleHelpLinkProvider>();

            return(new ShowInBrowserService(sonarQubeService, configurationProvider, browserService, helpLinkProvider));
        }
Beispiel #4
0
        private static void ConfigureSiteMock(GeneralOptionsDialogPage testSubject,
                                              ISonarLintSettings settings        = null,
                                              IVsBrowserService vsBrowserService = null)
        {
            settings ??= new ConfigurableSonarLintSettings();
            vsBrowserService ??= new Mock <IVsBrowserService>().Object;

            var mefHostMock = new Mock <IComponentModel>();

            mefHostMock.Setup(m => m.GetExtensions <ISonarLintSettings>()).Returns(() => new[] { settings });
            mefHostMock.Setup(m => m.GetExtensions <ILogger>()).Returns(() => new[] { new TestLogger() });
            mefHostMock.Setup(m => m.GetExtensions <IUserSettingsProvider>()).Returns(() => new[] { new Mock <IUserSettingsProvider>().Object });
            mefHostMock.Setup(m => m.GetExtensions <IVsBrowserService>()).Returns(() => new[] { vsBrowserService });

            var siteMock = new Mock <ISite>();

            siteMock.As <IServiceProvider>().Setup(m => m.GetService(It.Is <Type>(t => t == typeof(SComponentModel)))).Returns(mefHostMock.Object);

            testSubject.Site = siteMock.Object;
        }
Beispiel #5
0
        // For testing
        internal NotificationIndicatorViewModel(IServerNotificationsTelemetryManager telemetryManager,
                                                IVsBrowserService vsBrowserService,
                                                Action <Action> uiThreadInvoker,
                                                ITimer autocloseTimer)
        {
            this.telemetryManager = telemetryManager;
            this.uiThreadInvoker  = uiThreadInvoker;
            this.autocloseTimer   = autocloseTimer;

            NotificationEvents = new ObservableCollection <SonarQubeNotification>();
            text = BuildToolTipText();

            autocloseTimer.Elapsed  += OnAutocloseTimerElapsed;
            ClearUnreadEventsCommand = new RelayCommand(() => HasUnreadEvents = false);

            NavigateToNotification = new DelegateCommand(parameter =>
            {
                var notification = (SonarQubeNotification)parameter;
                vsBrowserService.Navigate(notification.Link.ToString());
                IsToolTipVisible = false;
                telemetryManager.NotificationClicked(notification.Category);
            });
        }
 public ShowInBrowserService(ISonarQubeService sonarQubeService,
                             IConfigurationProvider configurationProvider,
                             IVsBrowserService vsBrowserService)
     : this(sonarQubeService, configurationProvider, vsBrowserService, new RuleHelpLinkProvider())
 {
 }
Beispiel #7
0
 public NotificationIndicatorViewModel(IServerNotificationsTelemetryManager telemetryManager, IVsBrowserService vsBrowserService)
     : this(telemetryManager, vsBrowserService, ThreadHelper.Generic.Invoke,
            new TimerWrapper {
     AutoReset = false, Interval = 3000                          /* 3 sec */
 })
 {
 }
Beispiel #8
0
 internal ErrorTagTooltipProvider(IVsBrowserService browserService, IVsThemeColorProvider vsThemeColorProvider, IRuleHelpLinkProvider ruleHelpLinkProvider)
 {
     this.browserService       = browserService;
     this.vsThemeColorProvider = vsThemeColorProvider;
     this.ruleHelpLinkProvider = ruleHelpLinkProvider;
 }
Beispiel #9
0
 public ErrorTagTooltipProvider(IVsBrowserService browserService, IVsThemeColorProvider vsThemeColorProvider)
     : this(browserService, vsThemeColorProvider, new RuleHelpLinkProvider())
 {
 }