public async Task 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); } }
public async Task OnDimensionValueChanged(ConfigurationDimensionChange change, ChangeEventStage stage) { // No changes should happen for TFM so verify that the property is the same before and after var rootElement = ProjectRootElementFactory.Create(ProjectXmlTFMs); var projectAccessor = IProjectAccessorFactory.Create(rootElement); var provider = new TargetFrameworkProjectConfigurationDimensionProvider(projectAccessor); var project = UnconfiguredProjectFactory.Create(); var property = BuildUtilities.GetProperty(rootElement, ConfigurationGeneral.TargetFrameworksProperty); string expectedTFMs = property.Value; var args = new ProjectConfigurationDimensionValueChangedEventArgs( project, change, stage, ConfigurationGeneral.TargetFrameworkProperty, "NewTFM"); await provider.OnDimensionValueChangedAsync(args); Assert.NotNull(property); Assert.Equal(expectedTFMs, property.Value); }