Skip to content

Commit a04b846

Browse files
author
Mateo Torres Ruiz
committed
Put optional arguments last
Check the rid of the launched process
1 parent 6ae64aa commit a04b846

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/installer/tests/HostActivation.Tests/InstallLocationCommandResultExtensions.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ namespace HostActivation.Tests
1212
{
1313
internal static class InstallLocationCommandResultExtensions
1414
{
15-
private static bool IsRunningInWoW64() => OperatingSystem.IsWindows() && !Environment.Is64BitProcess;
15+
private static bool IsRunningInWoW64(string rid) => OperatingSystem.IsWindows() && Environment.Is64BitOperatingSystem && rid.Equals("win-x86");
1616

1717
public static AndConstraint<CommandResultAssertions> HaveUsedDotNetRootInstallLocation(this CommandResultAssertions assertion, string installLocation)
1818
{
19-
return assertion.HaveUsedDotNetRootInstallLocation(null, installLocation);
19+
return assertion.HaveUsedDotNetRootInstallLocation(installLocation, null, null);
2020
}
2121

22-
public static AndConstraint<CommandResultAssertions> HaveUsedDotNetRootInstallLocation(this CommandResultAssertions assertion, string arch, string installLocation)
22+
public static AndConstraint<CommandResultAssertions> HaveUsedDotNetRootInstallLocation(this CommandResultAssertions assertion,
23+
string installLocation,
24+
string arch,
25+
string rid)
2326
{
24-
string expectedEnvironmentVariable = !string.IsNullOrEmpty(arch) ? $"DOTNET_ROOT_{arch.ToUpper()}" : IsRunningInWoW64() ? "DOTNET_ROOT(x86)" : "DOTNET_ROOT";
27+
string expectedEnvironmentVariable = !string.IsNullOrEmpty(arch) ? $"DOTNET_ROOT_{arch.ToUpper()}" :
28+
IsRunningInWoW64(rid) ? "DOTNET_ROOT(x86)" : "DOTNET_ROOT";
2529

2630
return assertion.HaveStdErrContaining($"Using environment variable {expectedEnvironmentVariable}=[{installLocation}] as runtime location.");
2731
}
@@ -41,7 +45,7 @@ public static AndConstraint<CommandResultAssertions> HaveFoundDefaultInstallLoca
4145
return assertion.HaveStdErrContaining($"Found install location path '{installLocation}'.");
4246
}
4347

44-
public static AndConstraint<CommandResultAssertions> HaveFoundArchSpecificInstallLocationInConfigFile(this CommandResultAssertions assertion, string arch, string installLocation)
48+
public static AndConstraint<CommandResultAssertions> HaveFoundArchSpecificInstallLocationInConfigFile(this CommandResultAssertions assertion, string installLocation, string arch)
4549
{
4650
return assertion.HaveStdErrContaining($"Found architecture-specific install location path: '{installLocation}' ('{arch}').");
4751
}

src/installer/tests/HostActivation.Tests/MultiArchInstallLocation.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void EnvironmentVariable_CurrentArchitectureIsUsedIfEnvVarSet()
3333
.DotNetRoot(fixture.BuiltDotnet.BinPath, arch)
3434
.Execute()
3535
.Should().Pass()
36-
.And.HaveUsedDotNetRootInstallLocation(arch, fixture.BuiltDotnet.BinPath);
36+
.And.HaveUsedDotNetRootInstallLocation(fixture.BuiltDotnet.BinPath, arch, fixture.CurrentRid);
3737
}
3838

3939
[Fact]
@@ -67,7 +67,7 @@ public void EnvironmentVariable_ArchSpecificDotnetRootIsUsedOverDotnetRoot()
6767
.DotNetRoot(dotnet, arch)
6868
.Execute()
6969
.Should().Pass()
70-
.And.HaveUsedDotNetRootInstallLocation(arch, dotnet)
70+
.And.HaveUsedDotNetRootInstallLocation(dotnet, arch, fixture.CurrentRid)
7171
.And.NotHaveStdErrContaining("Using environment variable DOTNET_ROOT=");
7272
}
7373

@@ -98,8 +98,8 @@ public void InstallLocationFile_ArchSpecificLocationIsPickedFirst()
9898
.DotNetRoot(null)
9999
.Execute()
100100
.Should().HaveFoundDefaultInstallLocationInConfigFile(path1)
101-
.And.HaveFoundArchSpecificInstallLocationInConfigFile(arch1, path1)
102-
.And.HaveFoundArchSpecificInstallLocationInConfigFile(arch2, path2)
101+
.And.HaveFoundArchSpecificInstallLocationInConfigFile(path1, arch1)
102+
.And.HaveFoundArchSpecificInstallLocationInConfigFile(path2, arch2)
103103
.And.HaveUsedGlobalInstallLocation(path2);
104104
}
105105
}

0 commit comments

Comments
 (0)