Skip to content

Commit

Permalink
add missing test for scenario (#11087)
Browse files Browse the repository at this point in the history
Co-authored-by: Hariharan Thavachelvam <164553783+thavaahariharangit@users.noreply.github.com>
  • Loading branch information
brettfo and thavaahariharangit authored Dec 10, 2024
1 parent 6c5fa02 commit ad6a02f
Showing 1 changed file with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,61 @@ await TestUpdateForProject("Some.Package", "1.0.0", "2.0.0",
);
}

[Theory]
[InlineData(true)]
[InlineData(false)]
public async Task PackageIsUpdatedFromCommonTargetsFile(bool useDirectDiscovery)
{
await TestUpdateForProject("Some.Package", "1.0.0", "2.0.0",
packages:
[
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net8.0"),
MockNuGetPackage.CreateSimplePackage("Some.Package", "2.0.0", "net8.0"),
],
experimentsManager: new ExperimentsManager() { UseDirectDiscovery = useDirectDiscovery },
projectContents: """
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<Import Project="CommonPackages.targets" />
</Project>
""",
additionalFiles:
[
("CommonPackages.targets", """
<Project>
<ItemGroup>
<PackageReference Include="Some.Package">
<Version>1.0.0</Version>
</PackageReference>
</ItemGroup>
</Project>
""")
],
expectedProjectContents: """
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<Import Project="CommonPackages.targets" />
</Project>
""",
additionalFilesExpected:
[
("CommonPackages.targets", """
<Project>
<ItemGroup>
<PackageReference Include="Some.Package">
<Version>2.0.0</Version>
</PackageReference>
</ItemGroup>
</Project>
""")
]
);
}

[Fact]
public async Task CallingResolveDependencyConflictsNew()
{
Expand Down

0 comments on commit ad6a02f

Please sign in to comment.