public async Task ProjectDebuggerProvider_QueryDebugTargetsAsyncCorrectProvider()
        {
            var debugger = new ProjectDebuggerProvider(_configuredProjectMoq.Object, _LaunchSettingsProviderMoq.Object, _launchProviders);

            _activeProfile = new LaunchProfile()
            {
                Name = "test", CommandName = "IISExpress"
            };
            var result = await debugger.QueryDebugTargetsAsync(0);

            Assert.Equal(_webProviderSettings, result);

            _activeProfile = new LaunchProfile()
            {
                Name = "test", CommandName = "Docker"
            };
            result = await debugger.QueryDebugTargetsAsync(0);

            Assert.Equal(_dockerProviderSettings, result);

            _activeProfile = new LaunchProfile()
            {
                Name = "test", CommandName = "Project"
            };
            result = await debugger.QueryDebugTargetsAsync(0);

            Assert.Equal(_exeProviderSettings, result);
        }
示例#2
0
        private async Task <Guid> GetDebuggingEngineAsync(ConfiguredProject configuredProject)
        {
            var properties = configuredProject.Services.ProjectPropertiesProvider.GetCommonProperties();
            var framework  = await properties.GetEvaluatedPropertyValueAsync("TargetFrameworkIdentifier").ConfigureAwait(false);

            return(ProjectDebuggerProvider.GetManagedDebugEngineForFramework(framework));
        }
 public void ProjectDebuggerProvider_GetDebugEngineForFrameworkTests()
 {
     Assert.Equal(DebuggerEngines.ManagedCoreEngine, ProjectDebuggerProvider.GetManagedDebugEngineForFramework(".NetStandardApp"));
     Assert.Equal(DebuggerEngines.ManagedCoreEngine, ProjectDebuggerProvider.GetManagedDebugEngineForFramework(".NetStandard"));
     Assert.Equal(DebuggerEngines.ManagedCoreEngine, ProjectDebuggerProvider.GetManagedDebugEngineForFramework(".NetCore"));
     Assert.Equal(DebuggerEngines.ManagedCoreEngine, ProjectDebuggerProvider.GetManagedDebugEngineForFramework(".NetCoreApp"));
     Assert.Equal(DebuggerEngines.ManagedOnlyEngine, ProjectDebuggerProvider.GetManagedDebugEngineForFramework(".NETFramework"));
 }
示例#4
0
        public async Task QueryDebugTargetsAsync_WhenNoLaunchProfile_Throws()
        {
            var debugger = new ProjectDebuggerProvider(_configuredProjectMoq.Object, _LaunchSettingsProviderMoq.Object, _launchProviders);

            _activeProfile = null;

            var exception = await Assert.ThrowsAsync <Exception>(() =>
            {
                return(debugger.QueryDebugTargetsAsync(0));
            });
        }
        public async Task ProjectDebuggerProvider_CanLaunchAsyncTests()
        {
            Mock <ConfiguredProject> configuredProjectMoq = new Mock <ConfiguredProject>();
            var debugger = new ProjectDebuggerProvider(configuredProjectMoq.Object, new Mock <ILaunchSettingsProvider>().Object);

            bool result = await debugger.CanLaunchAsync(DebugLaunchOptions.NoDebug);

            Assert.True(result);
            result = await debugger.CanLaunchAsync(0);

            Assert.True(result);
        }
示例#6
0
        public async Task QueryDebugTargetsAsync_WhenNoInstalledProvider_Throws()
        {
            var debugger = new ProjectDebuggerProvider(_configuredProjectMoq.Object, _LaunchSettingsProviderMoq.Object, _launchProviders);

            _activeProfile = new LaunchProfile()
            {
                Name = "NoActionProfile", CommandName = "SomeOtherExtension"
            };

            var exception = await Assert.ThrowsAsync <Exception>(() =>
            {
                return(debugger.QueryDebugTargetsAsync(0));
            });
        }
        public async Task ProjectDebuggerProvider_QueryDebugTargetsNoLaunchProfiler()
        {
            var debugger = new ProjectDebuggerProvider(_configuredProjectMoq.Object, _LaunchSettingsProviderMoq.Object, _launchProviders);

            _activeProfile = null;
            try
            {
                var result = await debugger.QueryDebugTargetsAsync(0);

                Assert.False(true);
            }
            catch (Exception ex)
            {
                Assert.Equal(VSResources.ActiveLaunchProfileNotFound, ex.Message);
            }
        }
        public async Task ProjectDebuggerProvider_QueryDebugTargetsNoInstalledProvider()
        {
            var debugger = new ProjectDebuggerProvider(_configuredProjectMoq.Object, _LaunchSettingsProviderMoq.Object, _launchProviders);

            _activeProfile = new LaunchProfile()
            {
                Name = "NoActionProfile", CommandName = "SomeOtherExtension"
            };
            try
            {
                var result = await debugger.QueryDebugTargetsAsync(0);

                Assert.False(true);
            }
            catch (Exception ex)
            {
                Assert.Equal(string.Format(VSResources.DontKnowHowToRunProfile, _activeProfile.Name), ex.Message);
            }
        }
        public void ProjectDebuggerProvider_GetLaunchTargetsProviderForProfileTests()
        {
            var debugger = new ProjectDebuggerProvider(_configuredProjectMoq.Object, _LaunchSettingsProviderMoq.Object, _launchProviders);

            Assert.Equal(_mockWebProvider.Object, debugger.GetLaunchTargetsProvider(new LaunchProfile()
            {
                Name = "test", CommandName = "IISExpress"
            }));
            Assert.Equal(_mockDockerProvider.Object, debugger.GetLaunchTargetsProvider(new LaunchProfile()
            {
                Name = "test", CommandName = "Docker"
            }));
            Assert.Equal(_mockExeProvider.Object, debugger.GetLaunchTargetsProvider(new LaunchProfile()
            {
                Name = "test", CommandName = "Project"
            }));
            Assert.Equal(null, debugger.GetLaunchTargetsProvider(new LaunchProfile()
            {
                Name = "test", CommandName = "IIS"
            }));
        }