Make CliFolderPathCalculator
a static class.
The `CliFolderPathCalculator` class implements no interface and has no instance fields. This commit therefore makes it a static class.
This commit is contained in:
parent
8f8770be8a
commit
3e962bc131
19 changed files with 40 additions and 75 deletions
|
@ -26,7 +26,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
|||
|
||||
private Mock<INuGetPackagesArchiver> _nugetPackagesArchiverMock;
|
||||
private Mock<INuGetCacheSentinel> _nugetCacheSentinel;
|
||||
private CliFolderPathCalculator _cliFolderPathCalculator;
|
||||
|
||||
public GivenANuGetCachePrimer()
|
||||
{
|
||||
|
@ -40,12 +39,9 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
|||
|
||||
_nugetCacheSentinel = new Mock<INuGetCacheSentinel>();
|
||||
|
||||
_cliFolderPathCalculator = new CliFolderPathCalculator();
|
||||
|
||||
var nugetCachePrimer = new NuGetCachePrimer(
|
||||
_nugetPackagesArchiverMock.Object,
|
||||
_nugetCacheSentinel.Object,
|
||||
_cliFolderPathCalculator,
|
||||
_fileSystemMock.File);
|
||||
|
||||
nugetCachePrimer.PrimeCache();
|
||||
|
@ -63,7 +59,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
|||
var nugetCachePrimer = new NuGetCachePrimer(
|
||||
nugetPackagesArchiverMock.Object,
|
||||
_nugetCacheSentinel.Object,
|
||||
_cliFolderPathCalculator,
|
||||
fileSystemMock.File);
|
||||
|
||||
nugetCachePrimer.PrimeCache();
|
||||
|
@ -75,7 +70,7 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
|||
public void It_extracts_the_archive_to_the_fallback_folder()
|
||||
{
|
||||
_nugetPackagesArchiverMock.Verify(n =>
|
||||
n.ExtractArchive(_cliFolderPathCalculator.CliFallbackFolderPath),
|
||||
n.ExtractArchive(CliFolderPathCalculator.CliFallbackFolderPath),
|
||||
Times.Exactly(1));
|
||||
}
|
||||
|
||||
|
@ -95,7 +90,6 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
|||
var nugetCachePrimer = new NuGetCachePrimer(
|
||||
nugetPackagesArchiveMock.Object,
|
||||
nugetCacheSentinel.Object,
|
||||
_cliFolderPathCalculator,
|
||||
_fileSystemMock.File);
|
||||
|
||||
Action action = () => nugetCachePrimer.PrimeCache();
|
||||
|
|
|
@ -15,9 +15,8 @@ namespace Microsoft.DotNet.Configurer.UnitTests
|
|||
public void It_does_not_return_same_path_for_tools_package_and_tool_shim()
|
||||
{
|
||||
// shim name will conflict with the folder that is PackageId, if commandName and packageId are the same.
|
||||
var cliFolderPathCalculator = new CliFolderPathCalculator();
|
||||
cliFolderPathCalculator.ToolsPackagePath.Should().NotBe(cliFolderPathCalculator.ToolsShimPath);
|
||||
cliFolderPathCalculator.ToolsPackagePath.Should().NotBe(cliFolderPathCalculator.ToolsShimPathInUnix.Path);
|
||||
CliFolderPathCalculator.ToolsPackagePath.Should().NotBe(CliFolderPathCalculator.ToolsShimPath);
|
||||
CliFolderPathCalculator.ToolsPackagePath.Should().NotBe(CliFolderPathCalculator.ToolsShimPathInUnix.Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace Microsoft.DotNet.Tests
|
|||
|
||||
File.Exists(profiled).Should().BeTrue();
|
||||
File.ReadAllText(profiled).Should().Be(
|
||||
$"export PATH=\"$PATH:{new CliFolderPathCalculator().ToolsShimPathInUnix.PathWithDollar}\"");
|
||||
$"export PATH=\"$PATH:{CliFolderPathCalculator.ToolsShimPathInUnix.PathWithDollar}\"");
|
||||
}
|
||||
|
||||
[MacOsOnlyFact]
|
||||
|
@ -234,7 +234,7 @@ namespace Microsoft.DotNet.Tests
|
|||
command.ExecuteWithCapturedOutput("internal-reportinstallsuccess test").Should().Pass();
|
||||
|
||||
File.Exists(pathsd).Should().BeTrue();
|
||||
File.ReadAllText(pathsd).Should().Be(new CliFolderPathCalculator().ToolsShimPathInUnix.PathWithTilde);
|
||||
File.ReadAllText(pathsd).Should().Be(CliFolderPathCalculator.ToolsShimPathInUnix.PathWithTilde);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue