diff --git a/src/dotnet/ToolPackage/ToolPackageStore.cs b/src/dotnet/ToolPackage/ToolPackageStore.cs index f424b6062..24ec84289 100644 --- a/src/dotnet/ToolPackage/ToolPackageStore.cs +++ b/src/dotnet/ToolPackage/ToolPackageStore.cs @@ -14,7 +14,7 @@ namespace Microsoft.DotNet.ToolPackage public ToolPackageStore(DirectoryPath root) { - Root = root; + Root = new DirectoryPath(Path.GetFullPath(root.Value)); } public DirectoryPath Root { get; private set; } diff --git a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs index b8def9296..848849ba4 100644 --- a/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs +++ b/test/Microsoft.DotNet.ToolPackage.Tests/ToolPackageInstallerTests.cs @@ -685,7 +685,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests FilePath? tempProject = null, DirectoryPath? offlineFeed = null) { - var root = new DirectoryPath(Path.Combine(Path.GetFullPath(TempRoot.Root), Path.GetRandomFileName())); + var root = new DirectoryPath(Path.Combine(TempRoot.Root, Path.GetRandomFileName())); var reporter = new BufferedReporter(); IFileSystem fileSystem; @@ -714,6 +714,8 @@ namespace Microsoft.DotNet.ToolPackage.Tests offlineFeed: offlineFeed ?? new DirectoryPath("does not exist")); } + store.Root.Value.Should().Be(Path.GetFullPath(root.Value)); + return (store, installer, reporter, fileSystem); } diff --git a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs index e8219560c..43203a635 100644 --- a/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs +++ b/test/Microsoft.DotNet.Tools.Tests.ComponentMocks/ToolPackageStoreMock.cs @@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks IFileSystem fileSystem, Action uninstallCallback = null) { - Root = root; + Root = new DirectoryPath(Path.GetFullPath(root.Value)); _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _uninstallCallback = uninstallCallback; } diff --git a/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs index 813a70ec4..4707f8e1c 100644 --- a/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/UninstallToolCommandTests.cs @@ -73,7 +73,8 @@ namespace Microsoft.DotNet.Tests.Commands PackageId, PackageVersion)); - var packageDirectory = new DirectoryPath(ToolsDirectory).WithSubDirectories(PackageId, PackageVersion); + var packageDirectory = new DirectoryPath(Path.GetFullPath(ToolsDirectory)) + .WithSubDirectories(PackageId, PackageVersion); var shimPath = Path.Combine( ShimsDirectory, ProjectRestorerMock.FakeCommandName + @@ -114,7 +115,8 @@ namespace Microsoft.DotNet.Tests.Commands PackageId, PackageVersion)); - var packageDirectory = new DirectoryPath(ToolsDirectory).WithSubDirectories(PackageId, PackageVersion); + var packageDirectory = new DirectoryPath(Path.GetFullPath(ToolsDirectory)) + .WithSubDirectories(PackageId, PackageVersion); var shimPath = Path.Combine( ShimsDirectory, ProjectRestorerMock.FakeCommandName +