예제 #1
0
        public async Task QueryDebugTargetsAsync_NonConsoleAppLaunch_DoesNotIncludeIntegrationConsoleInLaunchOptions(string outputType)
        {
            var debugger = IVsDebugger10Factory.ImplementIsIntegratedConsoleEnabled(enabled: true);
            var properties = new Dictionary<string, string?>() {
                {"TargetPath", @"C:\ConsoleApp.exe"},
                {"TargetFrameworkIdentifier", @".NETFramework" }
                };

            var provider = GetDebugTargetsProvider(outputType, properties, debugger);

            var activeProfile = new LaunchProfile() { Name = "Name", CommandName = "Project" };

            var result = await provider.QueryDebugTargetsAsync(0, activeProfile);

            Assert.Single(result);
            Assert.True((result[0].LaunchOptions & DebugLaunchOptions.IntegratedConsole) != DebugLaunchOptions.IntegratedConsole);
        }
예제 #2
0
        public async Task QueryDebugTargetsAsync_ConsoleAppLaunchWithNoDebuggerWithIntegratedConsoleEnabled_DoesNotWrapInCmd()
        {
            var debugger = IVsDebugger10Factory.ImplementIsIntegratedConsoleEnabled(enabled: true);
            var properties = new Dictionary<string, string?>() {
                {"TargetPath", @"C:\ConsoleApp.exe"},
                {"TargetFrameworkIdentifier", @".NETFramework" }
                };

            var provider = GetDebugTargetsProvider("exe", properties, debugger);

            var activeProfile = new LaunchProfile() { Name = "Name", CommandName = "Project" };

            var result = await provider.QueryDebugTargetsAsync(DebugLaunchOptions.NoDebug, activeProfile);

            Assert.Single(result);
            Assert.DoesNotContain("cmd.exe", result[0].Executable);
        }
        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);

            return(new ConsoleDebugTargetsProvider(configuredProject, tokenReplacer, fileSystem, environment, activeDebugFramework, properties, threadingService, IVsUIServiceFactory.Create <SVsShellDebugger, IVsDebugger10>(debugger)));
        }
        private static ProjectLaunchTargetsProvider 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 ProjectLaunchTargetsProvider(unconfiguredProjectVsServices, configuredProject !, tokenReplacer, fileSystem !, environment, activeDebugFramework, properties !, threadingService, IVsUIServiceFactory.Create <SVsShellDebugger, IVsDebugger10>(debugger), remoteDebuggerAuthenticationService));
        }
        public async Task QueryDebugTargetsAsync_ConsoleAppLaunch_IncludesIntegratedConsoleInLaunchOptions(DebugLaunchOptions launchOptions)
        {
            var debugger   = IVsDebugger10Factory.ImplementIsIntegratedConsoleEnabled(enabled: true);
            var properties = new Dictionary <string, string?>()
            {
                { "TargetPath", @"C:\ConsoleApp.exe" },
                { "TargetFrameworkIdentifier", @".NETFramework" }
            };

            var scope = IProjectCapabilitiesScopeFactory.Create(capabilities: new string[] { ProjectCapabilities.IntegratedConsoleDebugging });

            var provider = GetDebugTargetsProvider("exe", properties, debugger, scope);

            var activeProfile = new LaunchProfile()
            {
                Name = "Name", CommandName = "Project"
            };

            var result = await provider.QueryDebugTargetsAsync(launchOptions, activeProfile);

            Assert.Single(result);
            Assert.True((result[0].LaunchOptions & DebugLaunchOptions.IntegratedConsole) == DebugLaunchOptions.IntegratedConsole);
        }