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)); }
private ConsoleDebugTargetsProvider GetDebugTargetsProvider(string outputType = "exe", Dictionary <string, string?>?properties = null, IVsDebugger10?debugger = null, IProjectCapabilitiesScope?scope = null) { _mockFS.WriteAllText(@"c:\test\Project\someapp.exe", ""); _mockFS.CreateDirectory(@"c:\test\Project"); _mockFS.CreateDirectory(@"c:\test\Project\bin\"); _mockFS.WriteAllText(@"c:\program files\dotnet\dotnet.exe", ""); var project = UnconfiguredProjectFactory.Create(filePath: _ProjectFile); var outputTypeEnum = new PageEnumValue(new EnumValue() { Name = outputType }); var data = new PropertyPageData(ConfigurationGeneral.SchemaName, ConfigurationGeneral.OutputTypeProperty, outputTypeEnum); var projectProperties = ProjectPropertiesFactory.Create(project, data); properties ??= new Dictionary <string, string?>() { { "RunCommand", @"dotnet" }, { "RunArguments", "exec " + "\"" + @"c:\test\project\bin\project.dll" + "\"" }, { "RunWorkingDirectory", @"bin\" }, { "TargetFrameworkIdentifier", @".NetCoreApp" }, { "OutDir", @"c:\test\project\bin\" } }; var delegatePropertiesMock = IProjectPropertiesFactory.MockWithPropertiesAndValues(properties); var delegateProvider = IProjectPropertiesProviderFactory.Create(null, delegatePropertiesMock.Object); var configuredProjectServices = Mock.Of <ConfiguredProjectServices>(o => o.ProjectPropertiesProvider == delegateProvider); var capabilitiesScope = scope ?? IProjectCapabilitiesScopeFactory.Create(capabilities: Enumerable.Empty <string>()); var configuredProject = Mock.Of <ConfiguredProject>(o => o.UnconfiguredProject == project && o.Services == configuredProjectServices && o.Capabilities == capabilitiesScope); var environment = IEnvironmentHelperFactory.ImplementGetEnvironmentVariable(_Path); return(CreateInstance(configuredProject: configuredProject, fileSystem: _mockFS, properties: projectProperties, environment: environment, debugger: debugger)); }