private static TaintIssuesControlViewModel CreateTestSubject( IAnalysisIssueVisualization[] issueVizs = null, ILocationNavigator locationNavigator = null, Mock <ITaintStore> store = null, IActiveDocumentTracker activeDocumentTracker = null, IActiveDocumentLocator activeDocumentLocator = null, ITelemetryManager telemetryManager = null, IShowInBrowserService showInBrowserService = null, IIssueSelectionService selectionService = null) { issueVizs ??= Array.Empty <IAnalysisIssueVisualization>(); store ??= new Mock <ITaintStore>(); store.Setup(x => x.GetAll()).Returns(issueVizs); activeDocumentTracker ??= Mock.Of <IActiveDocumentTracker>(); activeDocumentLocator ??= Mock.Of <IActiveDocumentLocator>(); showInBrowserService ??= Mock.Of <IShowInBrowserService>(); locationNavigator ??= Mock.Of <ILocationNavigator>(); telemetryManager ??= Mock.Of <ITelemetryManager>(); selectionService ??= Mock.Of <IIssueSelectionService>(); return(new TaintIssuesControlViewModel(store.Object, locationNavigator, activeDocumentTracker, activeDocumentLocator, showInBrowserService, telemetryManager, selectionService)); }
private static MenuCommand CreateCFamilyReproducerCommand(IActiveDocumentLocator documentLocator, ISonarLanguageRecognizer languageRecognizer, IAnalysisRequester analysisRequester, ILogger logger) { var dummyMenuService = new DummyMenuCommandService(); new CFamilyReproducerCommand(dummyMenuService, documentLocator, languageRecognizer, analysisRequester, logger); dummyMenuService.AddedMenuCommands.Count.Should().Be(1); return(dummyMenuService.AddedMenuCommands[0]); }
/// <summary> /// Initializes a new instance of the <see cref="DisableRuleCommand"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> /// <param name="menuCommandService">Command service to add command to, not null.</param> internal /* for testing */ CFamilyReproducerCommand(IMenuCommandService menuCommandService, IActiveDocumentLocator activeDocumentLocator, ISonarLanguageRecognizer languageRecognizer, IAnalysisRequester analysisRequester, ILogger logger) { if (menuCommandService == null) { throw new ArgumentNullException(nameof(menuCommandService)); } this.activeDocumentLocator = activeDocumentLocator ?? throw new ArgumentNullException(nameof(activeDocumentLocator)); this.sonarLanguageRecognizer = languageRecognizer ?? throw new ArgumentNullException(nameof(languageRecognizer)); this.analysisRequester = analysisRequester ?? throw new ArgumentNullException(nameof(analysisRequester)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); var menuCommandID = new CommandID(CommandSet, CommandId); menuItem = new OleMenuCommand(Execute, null, QueryStatus, menuCommandID); menuCommandService.AddCommand(menuItem); }