public void TestSetup()
        {
            Sink  = new StubTableDataSink();
            Table = new SonarLinkIssueDataSource();

            SubscribeToken = Table.Subscribe(Sink);
        }
示例#2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="teamExplorer">TeamExplorer VS service</param>
        /// <param name="issuesDataSource">SonarQube issues data source</param>
        /// <param name="projectPathsManager">Project paths manager</param>
        public ProjectViewModel(ITeamExplorer teamExplorer,
                                SonarLinkIssueDataSource issuesDataSource,
                                IProjectPathsManager projectPathsManager)
        {
            TeamExplorer         = teamExplorer;
            ErrorTable           = issuesDataSource;
            _projectPathsManager = projectPathsManager;

            // Bootstrap the projects view with an empty collection
            SonarProjects = Enumerable.Empty <SonarQubeProject>();

            FolderSelectCommand = new AsyncCommand(param => OnFolderSelectAsync((SonarQubeProject)param));
            ItemSelectCommand   = new AsyncCommand(param => OnItemSelectAsync((SonarQubeProject)param));
        }
        public void TestSetup()
        {
            var teamExplorer        = new Mock <ITeamExplorer>();
            var projectPathsManager = new Mock <IProjectPathsManager>();

            Client = new Mock <ISonarQubeClient>();
            Client.SetupGet(i => i.SonarQubeApiUrl).Returns(new Uri("https://server.com/"));
            ErrorSink = new StubTableDataSink();

            var table = new SonarLinkIssueDataSource();

            SubscribeToken = table.Subscribe(ErrorSink);

            Model = new ProjectViewModel(teamExplorer.Object, table, projectPathsManager.Object)
            {
                Client = Client.Object
            };
        }
        public SonarLinkProjectPage([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
                                    SonarLinkIssueDataSource issues,
                                    IProjectPathsManager projectPathsManager)
        {
            var service = serviceProvider.GetService(typeof(ITeamExplorer));

            if (service != null)
            {
                TeamExplorer = service as ITeamExplorer;
            }

            var table = GetErrorsTable(serviceProvider);

            table.AddSource(issues, SonarLinkIssueDataSource.Columns);

            PageContent = new ProjectView()
            {
                DataContext = new ProjectViewModel(TeamExplorer, issues, projectPathsManager)
            };

            ViewModel.ItemSelectCommand.CanExecuteChanged += ItemSelectCommand_CanExecuteChanged;
        }