Skip to content

Commit 118ceb9

Browse files
committed
Fix errors when dotnet prerelease runtimes are installed
1 parent f34c2ec commit 118ceb9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/NUnitEngine/nunit.engine.core.tests/DotNetHelperTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@ public static void CanParseInputLine(string line, string name, string packageVer
6161
true, new Version(9,0,0), "rc.2.24474.3")];
6262

6363
[TestCase("Microsoft.NETCore.App", "8.0.0", "8.0.22")]
64+
[TestCase("Microsoft.NETCore.App", "8.0.0.0", "8.0.22")]
65+
[TestCase("Microsoft.NETCore.App", "8.0.0.100", "8.0.22")]
66+
[TestCase("Microsoft.NETCore.App", "8.0.100", "9.0.11")]
67+
[TestCase("Microsoft.AspNetCore.App", "5.0.0", "8.0.22")] // Rather than 8.0.2
68+
[TestCase("Microsoft.AspNetCore.App", "7.0.0", "8.0.22")] // Rather than 8.0.2
6469
[TestCase("Microsoft.AspNetCore.App", "8.0.0", "8.0.22")] // Rather than 8.0.2
6570
[TestCase("Microsoft.WindowsDesktop.App", "9.0.0", "9.0.11")] // Rather than the pre-release version
71+
[TestCase("Microsoft.WindowsDesktop.App", "10.0.0", "10.0.0-rc.2.25502.107")]
6672
public static void FindBestRuntimeTests(string runtimeName, string targetVersion, string expectedVersion)
6773
{
6874
var availableRuntimes = SimulatedListRuntimesOutput.Where(r => r.Name == runtimeName);
@@ -86,7 +92,7 @@ public static void FindBestRuntimeTests(string runtimeName, string targetVersion
8692
DotNet.RuntimeInfo.Parse(@"Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]"),
8793
DotNet.RuntimeInfo.Parse(@"Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]"),
8894
DotNet.RuntimeInfo.Parse(@"Microsoft.WindowsDesktop.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]"),
89-
DotNet.RuntimeInfo.Parse(@"Microsoft.WindowsDesktop.App 10.0.0-rc.2.25502.107 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]"),
90-
DotNet.RuntimeInfo.Parse(@"Microsoft.WindowsDesktop.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]") ];
95+
DotNet.RuntimeInfo.Parse(@"Microsoft.WindowsDesktop.App 10.0.0-rc.2.25502.107 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]") ];
96+
//DotNet.RuntimeInfo.Parse(@"Microsoft.WindowsDesktop.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]") ];
9197
}
9298
}

src/NUnitEngine/nunit.engine.core/DotNetHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ internal static bool FindBestRuntime(Version targetVersion, IEnumerable<RuntimeI
114114
foreach (var candidate in availableRuntimes)
115115
{
116116
if (candidate.Version >= targetVersion)
117-
if (bestRuntime is null || candidate.Version.Major == targetVersion.Major)
117+
if (bestRuntime is null || candidate.Version.Major == bestRuntime.Version.Major)
118118
bestRuntime = candidate;
119119
}
120120

0 commit comments

Comments
 (0)