Exemplo n.º 1
0
        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));
        }
 public OpenInIDERequestHandler(
     IIDEWindowService ideWindowService,
     IToolWindowService toolWindowService,
     IOpenInIDEStateValidator ideStateValidator,
     ISonarQubeService sonarQubeService,
     IHotspotToIssueVisualizationConverter converter,
     ILocationNavigator navigator,
     IHotspotsStore hotspotsStore,
     IOpenInIDEFailureInfoBar failureInfoBar,
     IIssueSelectionService issueSelectionService,
     ITelemetryManager telemetryManager,
     ILogger logger)
 {
     // MEF-created so the arguments should never be null
     this.ideWindowService      = ideWindowService;
     this.toolWindowService     = toolWindowService;
     this.ideStateValidator     = ideStateValidator;
     this.sonarQubeService      = sonarQubeService;
     this.converter             = converter;
     this.navigator             = navigator;
     this.hotspotsStore         = hotspotsStore;
     this.failureInfoBar        = failureInfoBar;
     this.issueSelectionService = issueSelectionService;
     this.telemetryManager      = telemetryManager;
     this.logger = logger;
 }
 public NavigateToCodeLocationCommand(ILocationNavigator locationNavigator)
     : base(parameter =>
 {
     var locationViz = (IAnalysisIssueLocationVisualization)parameter;
     locationNavigator.TryNavigate(locationViz);
 }, parameter => parameter is IAnalysisIssueLocationVisualization)
 {
 }
        private static HotspotsControlViewModel CreateTestSubject(ObservableCollection <IAnalysisIssueVisualization> originalCollection = null,
                                                                  ILocationNavigator locationNavigator    = null,
                                                                  Mock <IHotspotsStore> hotspotsStore     = null,
                                                                  IIssueSelectionService selectionService = null)
        {
            originalCollection ??= new ObservableCollection <IAnalysisIssueVisualization>();
            var readOnlyWrapper = new ReadOnlyObservableCollection <IAnalysisIssueVisualization>(originalCollection);

            hotspotsStore ??= new Mock <IHotspotsStore>();
            hotspotsStore.Setup(x => x.GetAll()).Returns(readOnlyWrapper);

            selectionService ??= Mock.Of <IIssueSelectionService>();

            return(new HotspotsControlViewModel(hotspotsStore.Object, locationNavigator, selectionService));
        }
        public HotspotsControlViewModel(IHotspotsStore hotspotsStore,
                                        ILocationNavigator locationNavigator,
                                        IIssueSelectionService selectionService)
        {
            AllowMultiThreadedAccessToHotspotsList();

            this.selectionService = selectionService;
            selectionService.SelectedIssueChanged += SelectionService_SelectionChanged;

            this.store           = hotspotsStore;
            store.IssuesChanged += Store_IssuesChanged;

            UpdateHotspotsList();

            SetCommands(hotspotsStore, locationNavigator);
        }
Exemplo n.º 6
0
        public IssueVisualizationViewModel(IAnalysisIssueSelectionService selectionService,
                                           ILocationNavigator locationNavigator,
                                           IFileNameLocationListItemCreator fileNameLocationListItemCreator,
                                           INavigateToCodeLocationCommand navigateToCodeLocationCommand,
                                           INavigateToRuleDescriptionCommand navigateToRuleDescriptionCommand,
                                           INavigateToDocumentationCommand navigateToDocumentationCommand)
        {
            this.selectionService  = selectionService;
            this.locationNavigator = locationNavigator;
            this.fileNameLocationListItemCreator = fileNameLocationListItemCreator;

            NavigateToCodeLocationCommand    = navigateToCodeLocationCommand;
            NavigateToRuleDescriptionCommand = navigateToRuleDescriptionCommand;
            NavigateToDocumentationCommand   = navigateToDocumentationCommand;

            selectionService.SelectionChanged += SelectionEvents_OnSelectionChanged;

            UpdateState(SelectionChangeLevel.Issue,
                        selectionService.SelectedIssue,
                        selectionService.SelectedFlow,
                        selectionService.SelectedLocation);
        }
 private NavigateToCodeLocationCommand CreateTestSubject(ILocationNavigator locationNavigator = null)
 {
     return(new NavigateToCodeLocationCommand(locationNavigator));
 }
 public IssueFlowStepNavigator(IAnalysisIssueSelectionService selectionService, ILocationNavigator locationNavigator)
 {
     this.selectionService  = selectionService;
     this.locationNavigator = locationNavigator;
 }