Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/9.0.1xx] [FIX] tool-update: Compare tool versions correctly #45383

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private NuGetVersion GetBestMatchNugetVersion(PackageId packageId, VersionRange

private static bool ToolVersionAlreadyInstalled(IToolPackage oldPackageNullable, NuGetVersion nuGetVersion)
{
return oldPackageNullable != null && (oldPackageNullable.Version.Version == nuGetVersion.Version);
return oldPackageNullable != null && (oldPackageNullable.Version == nuGetVersion);
}

private static void EnsureVersionIsHigher(IToolPackage oldPackageNullable, IToolPackage newInstalledPackage, bool allowDowngrade)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,21 @@ public void GivenAnExistedLowerversionInstallationWhenUpdateAllItCanPrintSuccess
_packageId, LowerPackageVersion, HigherPackageVersion));
}

[Fact]
public void GivenAnExistedPreviewVersionInstallationWhenUpdateToHigherVersionItSucceeds()
{
var installCommand = CreateInstallCommand($"-g {_packageId} --version {HigherPreviewPackageVersion} --verbosity minimal");
installCommand.Execute();
_reporter.Lines.Clear();

var command = CreateUpdateCommand($"-g {_packageId} --version {HigherPackageVersion} --verbosity minimal");
command.Execute().Should().Be(0);

_reporter.Lines.First().Should().Contain(string.Format(
LocalizableStrings.UpdateSucceeded,
_packageId, HigherPreviewPackageVersion, HigherPackageVersion));
}

[Fact]
public void GivenAnExistedHigherversionInstallationWhenUpdateToLowerVersionItErrors()
{
Expand Down
Loading