Exemplo n.º 1
0
        private static ProjectOutputWindowPaneProvider CreateInstance(IProjectThreadingService threadingService = null, IVsOutputWindow outputWindow = null)
        {
            threadingService = threadingService ?? IProjectThreadingServiceFactory.Create();

            var outputWindowService = IVsUIServiceFactory.Create <SVsOutputWindow, IVsOutputWindow>(outputWindow);

            return(new ProjectOutputWindowPaneProvider(threadingService, outputWindowService));
        }
Exemplo n.º 2
0
        internal AbstractAddClassProjectCommand CreateInstance(IPhysicalProjectTree projectTree = null, IUnconfiguredProjectVsServices projectVsServices = null, IProjectTreeProvider provider = null, IVsAddProjectItemDlg addItemDialog = null)
        {
            projectTree       = projectTree ?? IPhysicalProjectTreeFactory.Create(provider);
            projectVsServices = projectVsServices ?? IUnconfiguredProjectVsServicesFactory.Implement(threadingServiceCreator: () => IProjectThreadingServiceFactory.Create());
            var addItemDialogService = IVsUIServiceFactory.Create <SVsAddProjectItemDlg, IVsAddProjectItemDlg>(addItemDialog);

            return(CreateInstance(projectTree, projectVsServices, addItemDialogService));
        }
Exemplo n.º 3
0
        private static (VisualStudioWaitIndicator, Action cancel) CreateInstance(string title = "", string message = "", bool isCancelable = false)
        {
            var joinableTaskContext = new JoinableTaskContext();

            var(threadedWaitDialogFactory, cancel) = IVsThreadedWaitDialogFactoryFactory.Create(title, message, isCancelable);
            var threadedWaitDialogFactoryService = IVsUIServiceFactory.Create <SVsThreadedWaitDialogFactory, IVsThreadedWaitDialogFactory>(threadedWaitDialogFactory);

            var instance = new VisualStudioWaitIndicator(joinableTaskContext, threadedWaitDialogFactoryService);

            return(instance, cancel);
        }
        internal AbstractAddItemCommandHandler CreateInstance(IPhysicalProjectTree projectTree = null, IUnconfiguredProjectVsServices projectVsServices = null, IProjectTreeProvider provider = null, IVsAddProjectItemDlg addItemDialog = null, string capability = null)
        {
            var configuredProject = ConfiguredProjectFactory.Create(IProjectCapabilitiesScopeFactory.Create(new string[] { capability ?? TestAddItemCommand.Capability }));

            projectTree ??= IPhysicalProjectTreeFactory.Create(provider);
            projectVsServices ??= IUnconfiguredProjectVsServicesFactory.Implement(
                threadingServiceCreator: () => IProjectThreadingServiceFactory.Create()
                );
            var addItemDialogService = IVsUIServiceFactory.Create <SVsAddProjectItemDlg, IVsAddProjectItemDlg>(addItemDialog);

            string result      = "DirName";
            var    vsShellMock = new Mock <IVsShell>();

            vsShellMock.Setup(x => x.LoadPackageString(ref It.Ref <Guid> .IsAny, (uint)TestAddItemCommand.ResourceIds.DirName, out result)).Returns(0);
            result = "TemplateName";
            vsShellMock.Setup(x => x.LoadPackageString(ref It.Ref <Guid> .IsAny, (uint)TestAddItemCommand.ResourceIds.TemplateName, out result)).Returns(0);

            var vsShellService = IVsUIServiceFactory.Create <SVsShell, IVsShell>(vsShellMock.Object);

            return(new TestAddItemCommand(configuredProject, projectTree, projectVsServices, addItemDialogService, vsShellService));
        }
        private ConsoleDebugTargetsProvider CreateInstance(UnconfiguredProject project         = null,
                                                           ConfiguredProject configuredProject = null,
                                                           IDebugTokenReplacer tokenReplacer   = null,
                                                           IFileSystem fileSystem         = null,
                                                           IEnvironmentHelper environment = null,
                                                           IActiveDebugFrameworkServices activeDebugFramework = null,
                                                           ProjectProperties properties = null,
                                                           IProjectThreadingService threadingService = null,
                                                           IVsDebugger10 debugger = null)
        {
            environment ??= Mock.Of <IEnvironmentHelper>();
            tokenReplacer ??= IDebugTokenReplacerFactory.Create();
            activeDebugFramework ??= IActiveDebugFrameworkServicesFactory.ImplementGetConfiguredProjectForActiveFrameworkAsync(configuredProject);
            threadingService ??= IProjectThreadingServiceFactory.Create();
            debugger ??= IVsDebugger10Factory.ImplementIsIntegratedConsoleEnabled(enabled: false);


            return(new ConsoleDebugTargetsProvider(project, tokenReplacer, fileSystem, environment, activeDebugFramework, properties, threadingService, IVsUIServiceFactory.Create <SVsShellDebugger, IVsDebugger10>(debugger)));
        }
Exemplo n.º 6
0
        private static ConsoleDebugTargetsProvider CreateInstance(
            ConfiguredProject?configuredProject = null,
            IDebugTokenReplacer?tokenReplacer   = null,
            IFileSystem?fileSystem         = null,
            IEnvironmentHelper?environment = null,
            IActiveDebugFrameworkServices?activeDebugFramework = null,
            ProjectProperties?properties = null,
            IProjectThreadingService?threadingService = null,
            IVsDebugger10?debugger = null)
        {
            environment ??= Mock.Of <IEnvironmentHelper>();
            tokenReplacer ??= IDebugTokenReplacerFactory.Create();
            activeDebugFramework ??= IActiveDebugFrameworkServicesFactory.ImplementGetConfiguredProjectForActiveFrameworkAsync(configuredProject);
            threadingService ??= IProjectThreadingServiceFactory.Create();
            debugger ??= IVsDebugger10Factory.ImplementIsIntegratedConsoleEnabled(enabled: false);

            IUnconfiguredProjectVsServices unconfiguredProjectVsServices = IUnconfiguredProjectVsServicesFactory.Implement(() => IVsHierarchyFactory.Create());

            IRemoteDebuggerAuthenticationService remoteDebuggerAuthenticationService = Mock.Of <IRemoteDebuggerAuthenticationService>();

            return(new ConsoleDebugTargetsProvider(unconfiguredProjectVsServices, configuredProject, tokenReplacer, fileSystem, environment, activeDebugFramework, properties, threadingService, IVsUIServiceFactory.Create <SVsShellDebugger, IVsDebugger10>(debugger), remoteDebuggerAuthenticationService));
        }