public async Task GetConfiguredProjectForActiveFrameworkAsync_ReturnsCorrectProject(string framework, string selectedConfigFramework) { var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData() { Category = ProjectDebugger.SchemaName, PropertyName = ProjectDebugger.ActiveDebugFrameworkProperty, Value = framework }; var data2 = new PropertyPageData() { Category = ConfigurationGeneral.SchemaName, PropertyName = ConfigurationGeneral.TargetFrameworksProperty, Value = "net462;net461;netcoreapp1.0" }; var projects = ImmutableDictionary <string, ConfiguredProject> .Empty .Add("net461", ConfiguredProjectFactory.Create(null, new StandardProjectConfiguration("Debug|AnyCPU|net461", Empty.PropertiesMap .Add("Configuration", "Debug") .Add("Platform", "AnyCPU") .Add("TargetFramework", "net461")))) .Add("netcoreapp1.0", ConfiguredProjectFactory.Create(null, new StandardProjectConfiguration("Debug|AnyCPU|netcoreapp1.0", Empty.PropertiesMap .Add("Configuration", "Debug") .Add("Platform", "AnyCPU") .Add("TargetFramework", "netcoreapp1.0")))) .Add("net462", ConfiguredProjectFactory.Create(null, new StandardProjectConfiguration("Debug|AnyCPU|net462", Empty.PropertiesMap .Add("Configuration", "Debug") .Add("Platform", "AnyCPU") .Add("TargetFramework", "net462")))); var projectProperties = ProjectPropertiesFactory.Create(project, data, data2); var projectConfgProvider = new IActiveConfiguredProjectsProviderFactory(MockBehavior.Strict) .ImplementGetActiveConfiguredProjectsMapAsync(projects); var commonServices = IUnconfiguredProjectCommonServicesFactory.Create(projectProperties: projectProperties); var debugFrameworkSvcs = new ActiveDebugFrameworkServices(projectConfgProvider.Object, commonServices); var activeConfiguredProject = await debugFrameworkSvcs.GetConfiguredProjectForActiveFrameworkAsync(); Assert.Equal(selectedConfigFramework, activeConfiguredProject.ProjectConfiguration.Dimensions.GetValueOrDefault("TargetFramework")); }
public async Task GetProjectFrameworksAsync_ReturnsFrameworksInCorrectOrder(string frameworks, string[] expectedOrder) { var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData() { Category = ConfigurationGeneral.SchemaName, PropertyName = ConfigurationGeneral.TargetFrameworksProperty, Value = frameworks }; var projectProperties = ProjectPropertiesFactory.Create(project, data); var commonServices = IUnconfiguredProjectCommonServicesFactory.Create(projectProperties: projectProperties); var debugFrameworkSvcs = new ActiveDebugFrameworkServices(null, commonServices); var result = await debugFrameworkSvcs.GetProjectFrameworksAsync(); Assert.Equal(expectedOrder.Length, result.Count); for (int i = 0; i < result.Count; i++) { Assert.Equal(expectedOrder[i], result[i]); } }