diff --git a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs index ead8755bcf..c862d6cc93 100644 --- a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +++ b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs @@ -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: """ + + + net8.0 + + + + """, + additionalFiles: + [ + ("CommonPackages.targets", """ + + + + 1.0.0 + + + + """) + ], + expectedProjectContents: """ + + + net8.0 + + + + """, + additionalFilesExpected: + [ + ("CommonPackages.targets", """ + + + + 2.0.0 + + + + """) + ] + ); + } + [Fact] public async Task CallingResolveDependencyConflictsNew() {