private static ExportProvider GetDevEnvCompositionOrThrow(IServiceProvider provider) { throw new NotSupportedException(); var devEnv = DevEnv.Get(provider); //return devEnv.ServiceLocator; }
public string GetSelectedProjectClide() { var devenv = DevEnv.Get(VsIdeTestHostContext.ServiceProvider); var project = devenv.SolutionExplorer().Solution.SelectedNodes.OfType <IProjectNode>().First(); return(project.PhysicalPath); }
public override void TestInitialize() { base.TestInitialize(); base.OpenSolution("SampleSolution\\SampleSolution.sln"); Solution = DevEnv.Get(ServiceProvider).SolutionExplorer().Solution; Assert.IsNotNull(Solution); LibraryNode = Solution.FindProjects(p => p.DisplayName == "ClassLibrary").First(); Assert.IsNotNull(LibraryNode); DteLibrary = LibraryNode.As <EnvDTE.Project>(); IVsLibrary = LibraryNode.As <IVsProject>(); VsLangLibrary = LibraryNode.As <VSLangProj.VSProject>(); DoActionWithWaitAndRetry( () => MsBuildLibrary = LibraryNode.As <Microsoft.Build.Evaluation.Project>(), 100, 50, () => MsBuildLibrary == null); Assert.IsNotNull(DteLibrary); Assert.IsNotNull(IVsLibrary); Assert.IsNotNull(VsLangLibrary); Assert.IsNotNull(MsBuildLibrary); }
public void when_additional_components_installed_then_registers_on_composition_container() { var devEnv = DevEnv.Get(new PackageProvidesComponents()); var component = devEnv.ServiceLocator.GetInstance <ProvidedComponent>(); Assert.NotNull(component); }
public override void TestInitialize() { base.TestInitialize(); base.OpenSolution("SampleSolution\\SampleSolution.sln"); Solution = DevEnv.Get(ServiceProvider).SolutionExplorer().Solution; Library = Solution.FindProjects(p => p.DisplayName == "ClassLibrary").First(); }
public void when_retrieving_selected_project_then_performance_is_acceptable() { OpenSolution(@"C:\Delete\Blocks\EnterpriseLibrary.sln"); var solution = this.ServiceProvider.GetService <SVsSolution, IVsSolution>(); var devenv = DevEnv.Get(VsIdeTestHostContext.ServiceProvider); devenv.SolutionExplorer().Solution.FindProjects().First().Select(); var iterations = 1000; var dteSelection = Measure(iterations, () => Console.WriteLine(GetSelectedProjectDte())); var ivsSelection = Measure(iterations, () => Console.WriteLine(GetSelectedProjectIVs())); var clideSelection = Measure(iterations, () => Console.WriteLine(GetSelectedProjectClide())); Debug.WriteLine("DTE Selection: {0}", dteSelection); Debug.WriteLine("IVs Selection: {0}", ivsSelection); Debug.WriteLine("Clide Selection: {0}", clideSelection); }
// Uncomment Ignore, and download EntLib to test performance. //[Ignore] public void when_retrieving_active_project_then_performance_is_acceptable() { this.OpenSolution("SampleSolution\\SampleSolution.sln"); var solution = VsIdeTestHostContext.ServiceProvider.GetService <SVsSolution, IVsSolution>(); var devenv = DevEnv.Get(VsIdeTestHostContext.ServiceProvider); devenv.SolutionExplorer().Solution.FindProjects().First().Select(); var iterations = 1000; var dteSelection = Measure(iterations, () => Console.WriteLine(GetSelectedProjectDte())); var ivsSelection = Measure(iterations, () => Console.WriteLine(GetSelectedProjectIVs())); var clideSelection = Measure(iterations, () => Console.WriteLine(devenv.SolutionExplorer().Solution.ActiveProject.PhysicalPath)); Debug.WriteLine("DTE Selection: {0}", dteSelection); Debug.WriteLine("IVs Selection: {0}", ivsSelection); Debug.WriteLine("Clide Selection: {0}", clideSelection); }
public void when_traversing_solution_to_find_projects_then_performance_is_acceptable() { OpenSolution(@"C:\Delete\Blocks\EnterpriseLibrary.sln"); var solution = VsIdeTestHostContext.ServiceProvider.GetService <SVsSolution, IVsSolution>(); var watch = Stopwatch.StartNew(); var projects = GetProjects(solution, VSLangProj.PrjKind.prjKindCSharpProject); watch.Stop(); var elapsed = watch.ElapsedTicks; var devenv = DevEnv.Get(VsIdeTestHostContext.ServiceProvider); // Warm-up factories. //devenv.SolutionExplorer().Solution.FindProjects().Select(node => node.As<Project>()).Where(prj => prj.Kind == VSLangProj.PrjKind.prjKindCSharpProject).ToArray(); watch = Stopwatch.StartNew(); projects = devenv.SolutionExplorer().Solution.FindProjects().Select(node => node.As <Project>()).ToArray(); watch.Stop(); Debug.WriteLine("IVS: {0}, Clide: {1}", elapsed, watch.ElapsedTicks); }