1919
2020namespace Microsoft . DotNet . Tests . Commands . Tool
2121{
22- public class ToolUpdateGlobalOrToolPathCommandTests
22+ public class ToolUpdateGlobalOrToolPathCommandTests : SdkTest
2323 {
2424 private readonly BufferedReporter _reporter ;
2525 private readonly IFileSystem _fileSystem ;
@@ -36,7 +36,7 @@ public class ToolUpdateGlobalOrToolPathCommandTests
3636 private readonly string _tempDirectory ;
3737 private readonly ToolPackageDownloaderMock2 _toolPackageDownloader ;
3838
39- public ToolUpdateGlobalOrToolPathCommandTests ( )
39+ public ToolUpdateGlobalOrToolPathCommandTests ( ITestOutputHelper log ) : base ( log )
4040 {
4141 _reporter = new BufferedReporter ( ) ;
4242 _fileSystem = new FileSystemMockBuilder ( ) . UseCurrentSystemTemporaryDirectory ( ) . Build ( ) ;
@@ -411,10 +411,15 @@ public void GivenAnExistedLowerversionWhenReinstallThrowsItRollsBack()
411411 [ Fact ]
412412 public void GivenPackagedShimIsProvidedWhenRunWithPackageIdItCreatesShimUsingPackagedShim ( )
413413 {
414+
415+ Log . WriteLine ( $ "Current RuntimeIdentifier: { RuntimeInformation . RuntimeIdentifier } ") ;
416+
417+ string toolTargetRuntimeIdentifier = OperatingSystem . IsWindows ( ) ? "win-x64" : RuntimeInformation . RuntimeIdentifier ;
418+
414419 var extension = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? ".exe" : string . Empty ;
415420 var tokenToIdentifyPackagedShim = "packagedShim" ;
416421 var mockPackage = _mockFeeds [ 0 ] . Packages . Single ( p => p . PackageId == _packageId . ToString ( ) && p . Version == HigherPackageVersion ) ;
417- mockPackage . AdditionalFiles [ $ "tools/{ ToolPackageDownloaderMock2 . DefaultTargetFramework } /any/shims/win-x64 /{ mockPackage . ToolCommandName } { extension } "] = tokenToIdentifyPackagedShim ;
422+ mockPackage . AdditionalFiles [ $ "tools/{ ToolPackageDownloaderMock2 . DefaultTargetFramework } /any/shims/{ toolTargetRuntimeIdentifier } /{ mockPackage . ToolCommandName } { extension } "] = tokenToIdentifyPackagedShim ;
418423
419424 CreateInstallCommand ( $ "-g { _packageId } --version { LowerPackageVersion } ") . Execute ( ) ;
420425 _reporter . Lines . Clear ( ) ;
@@ -444,14 +449,11 @@ string ExpectedCommandPath()
444449 private ToolInstallGlobalOrToolPathCommand CreateInstallCommand ( string options , string packageId = null )
445450 {
446451 ParseResult result = Parser . Instance . Parse ( "dotnet tool install " + options ) ;
447- var store = new ToolPackageStoreMock (
448- new DirectoryPath ( _toolsDirectory ) ,
449- _fileSystem ) ;
450452
451453 return new ToolInstallGlobalOrToolPathCommand (
452454 result ,
453455 packageId is null ? _packageId : new PackageId ( packageId ) ,
454- ( location , forwardArguments , currentWorkingDirectory ) => ( _store , _store , _toolPackageDownloader , new ToolPackageUninstallerMock ( _fileSystem , store ) ) ,
456+ ( location , forwardArguments , currentWorkingDirectory ) => ( _store , _store , _toolPackageDownloader , new ToolPackageUninstallerMock ( _fileSystem , _store ) ) ,
455457 ( _ , _ ) => GetMockedShellShimRepository ( ) ,
456458 _environmentPathInstructionMock ,
457459 _reporter ) ;
0 commit comments