diff --git a/src/NvGet.Tests/Constants.cs b/src/NvGet.Tests/Constants.cs index 59dc8ef..04a9156 100644 --- a/src/NvGet.Tests/Constants.cs +++ b/src/NvGet.Tests/Constants.cs @@ -16,5 +16,12 @@ public static class Constants }; public static readonly TestPackageFeed TestFeed = new TestPackageFeed(TestFeedUri, TestPackages); + + public static readonly Dictionary TestPackages2 = new Dictionary + { + {"Uno.UI", new[] { "2.1.39", "2.2.0", "2.2.1", "2.3.0" } }, + }; + + public static readonly TestPackageFeed TestFeed2 = new TestPackageFeed(TestFeedUri, TestPackages2); } } diff --git a/src/NvGet.Tests/Tools/Updater/UpdaterParametersTests.cs b/src/NvGet.Tests/Tools/Updater/UpdaterParametersTests.cs index be77165..ad0bb10 100644 --- a/src/NvGet.Tests/Tools/Updater/UpdaterParametersTests.cs +++ b/src/NvGet.Tests/Tools/Updater/UpdaterParametersTests.cs @@ -111,6 +111,26 @@ public async Task GivenRangeOverrides_KeepMinor() Assert.AreEqual(NuGetVersion.Parse("2.3.0-dev.44"), version.Version); } + [TestMethod] + public async Task GivenRangeOverrides_KeepPatch() + { + var reference = new PackageReference("Uno.UI", "2.2.0"); + + var parameters = new UpdaterParameters + { + TargetVersions = { "dev", "stable" }, + Feeds = { Constants.TestFeed2 }, + VersionOverrides = + { + { reference.Identity.Id, (false, UpgradePolicy.Patch, VersionRange.Parse("0.0.0.0")) }, + }, + }; + + var version = await parameters.GetLatestVersion(CancellationToken.None, reference); + + Assert.AreEqual(NuGetVersion.Parse("2.2.1"), version.Version); + } + [TestMethod] public async Task GivenRangeOverrides_CorrectVersionsAreResolved_AndTargetVersionIsHonored() {