Fixing project dependencies migration so that they are only conditioned when they where under a TFM in the project.json to begin with.
This commit is contained in:
parent
caf072daeb
commit
be419e3b70
8 changed files with 157 additions and 12 deletions
|
@ -34,7 +34,32 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
var projectReferences = mockProj.Items.Where(item => item.ItemType.Equals("ProjectReference", StringComparison.Ordinal));
|
||||
projectReferences.Count().Should().Be(1);
|
||||
|
||||
projectReferences.First().Include.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj"));
|
||||
var projectReference = projectReferences.First();
|
||||
projectReference.Include.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj"));
|
||||
projectReference.Parent.Condition.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TFM_specific_Project_dependencies_are_migrated_to_ProjectReference_under_condition_ItemGroup()
|
||||
{
|
||||
var solutionDirectory =
|
||||
TestAssetsManager.CreateTestInstance("TestAppWithLibraryUnderTFM", callingMethod: "p").Path;
|
||||
|
||||
var appDirectory = Path.Combine(solutionDirectory, "TestApp");
|
||||
|
||||
var projectContext = ProjectContext.Create(appDirectory, FrameworkConstants.CommonFrameworks.NetCoreApp10);
|
||||
var mockProj = ProjectRootElement.Create();
|
||||
var testSettings = new MigrationSettings(appDirectory, appDirectory, "1.0.0", mockProj, null);
|
||||
var testInputs = new MigrationRuleInputs(new[] {projectContext}, mockProj, mockProj.AddItemGroup(),
|
||||
mockProj.AddPropertyGroup());
|
||||
new MigrateProjectDependenciesRule().Apply(testSettings, testInputs);
|
||||
|
||||
var projectReferences = mockProj.Items.Where(item => item.ItemType.Equals("ProjectReference", StringComparison.Ordinal));
|
||||
projectReferences.Count().Should().Be(1);
|
||||
|
||||
var projectReference = projectReferences.First();
|
||||
projectReference.Include.Should().Be(Path.Combine("..", "TestLibrary", "TestLibrary.csproj"));
|
||||
projectReference.Parent.Condition.Should().Be(" '$(TargetFramework)' == 'netcoreapp1.0' ");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue