Ejemplo n.º 1
0
        public async void TargetFrameworkProjectConfigurationDimensionProvider_GetProjectConfigurationDimensionsAsync_TFM()
        {
            using (var projectFile = new MsBuildProjectFile(projectXmlTFM))
            {
                IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project);
                var provider            = new TargetFrameworkProjectConfigurationDimensionProvider(_projectXmlAccessor);
                var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename);
                var values = await provider.GetProjectConfigurationDimensionsAsync(unconfiguredProject);

                Assert.Equal(0, values.Count());
            }
        }
Ejemplo n.º 2
0
        public async void TargetFrameworkProjectConfigurationDimensionProvider_GetDefaultValuesForDimensionsAsync_TFMs()
        {
            using (var projectFile = new MsBuildProjectFile(projectXmlTFMs))
            {
                IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project);
                var provider            = new TargetFrameworkProjectConfigurationDimensionProvider(_projectXmlAccessor);
                var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename);
                var values = await provider.GetDefaultValuesForDimensionsAsync(unconfiguredProject);

                Assert.Equal(1, values.Count());
                var value = values.First();
                Assert.Equal(ConfigurationGeneral.TargetFrameworkProperty, value.Key);
                Assert.Equal("netcoreapp1.0", value.Value);
            }
        }
Ejemplo n.º 3
0
        public async void TargetFrameworkProjectConfigurationDimensionProvider_OnDimensionValueChanged(ConfigurationDimensionChange change, ChangeEventStage stage)
        {
            // No changes should happen for TFM so verify that the property is the same before and after
            using (var projectFile = new MsBuildProjectFile(projectXmlTFMs))
            {
                IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project);
                var    provider            = new TargetFrameworkProjectConfigurationDimensionProvider(_projectXmlAccessor);
                var    unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename);
                var    property            = BuildUtilities.GetProperty(projectFile.Project, ConfigurationGeneral.TargetFrameworksProperty);
                string expectedTFMs        = property.Value;

                ProjectConfigurationDimensionValueChangedEventArgs args = new ProjectConfigurationDimensionValueChangedEventArgs(
                    unconfiguredProject,
                    change,
                    stage,
                    ConfigurationGeneral.TargetFrameworkProperty,
                    "NewTFM");
                await provider.OnDimensionValueChangedAsync(args);

                Assert.NotNull(property);
                Assert.Equal(expectedTFMs, property.Value);
            }
        }