Пример #1
0
        public void GetSolutionProjectsNull()
        {
            var solution = Substitute.For <Solution>();

            dte2.Solution.Returns(solution);
            var projects = new List <Project>();

            solution.Projects.GetEnumerator().Returns(projects.GetEnumerator());
            var envDteUtil = envDteUtilFactory.Create(taskContext, dte2);
            var results    = envDteUtil.GetSolutionProjects();

            Assert.AreEqual(0, results.Count);
        }
        public virtual ISolutionExplorer GetSolutionExplorer()
        {
            if (_solutionExplorer == null)
            {
                JoinableTaskContext taskContext = GetJoinableTaskContext();
                var vcProjectAdapterFactory     = new VcProjectAdapter.Factory();
                var dte2 = Package.GetGlobalService(typeof(DTE)) as DTE2;
                var envDteUtilFactory = new EnvDteUtil.Factory();
                var envDteUtil        = envDteUtilFactory.Create(taskContext, dte2);
                _solutionExplorer =
                    new SolutionExplorer(taskContext, vcProjectAdapterFactory, envDteUtil);
            }

            return(_solutionExplorer);
        }
Пример #3
0
        public override ISolutionExplorer GetSolutionExplorer()
        {
            if (_solutionExplorer != null)
            {
                return(_solutionExplorer);
            }

            var taskContext       = GetJoinableTaskContext();
            var dte2              = Substitute.For <DTE2>();
            var envDteUtilFactory = new EnvDteUtil.Factory();
            var dte2Util          = envDteUtilFactory.Create(taskContext, dte2);

            _solutionExplorer = new SolutionExplorer(taskContext, null, dte2Util);

            return(_solutionExplorer);
        }