Fixing ProjectDependenciesCommandFactory to resolve tools
if the package name is different from the dll name Addresses #2592
This commit is contained in:
parent
3d8cbba932
commit
1aac8fb643
12 changed files with 231 additions and 21 deletions
|
@ -22,8 +22,8 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
public class GivenAProjectDependenciesCommandFactory : TestBase
|
||||
{
|
||||
private static readonly NuGetFramework s_desktopTestFramework = FrameworkConstants.CommonFrameworks.Net451;
|
||||
|
||||
private static readonly NuGetFramework s_desktopTestFramework = FrameworkConstants.CommonFrameworks.Net451;
|
||||
|
||||
[WindowsOnlyFact]
|
||||
public void It_resolves_desktop_apps_defaulting_to_Debug_Configuration()
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
configuration: configuration)
|
||||
.ExecuteWithCapturedOutput()
|
||||
.Should()
|
||||
|
@ -65,7 +65,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
configuration: configuration)
|
||||
.ExecuteWithCapturedOutput()
|
||||
.Should()
|
||||
|
@ -96,7 +96,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
configuration: configuration)
|
||||
.ExecuteWithCapturedOutput()
|
||||
.Should()
|
||||
|
@ -127,7 +127,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
configuration: configuration)
|
||||
.ExecuteWithCapturedOutput()
|
||||
.Should()
|
||||
|
@ -147,5 +147,36 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
command.CommandName.Should().Contain(Path.Combine(testInstance.TestRoot, "bin", configuration));
|
||||
Path.GetFileName(command.CommandName).Should().Be("dotnet-desktop-and-portable.exe");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_resolves_tools_whose_package_name_is_different_than_dll_name()
|
||||
{
|
||||
var configuration = "Debug";
|
||||
|
||||
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "TestProjects"));
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDependencyWithOutputName")
|
||||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
Path.Combine(testInstance.TestRoot, "project.json"),
|
||||
configuration: configuration)
|
||||
.ExecuteWithCapturedOutput()
|
||||
.Should()
|
||||
.Pass();
|
||||
|
||||
var context = ProjectContext.Create(testInstance.TestRoot, FrameworkConstants.CommonFrameworks.NetCoreApp10);
|
||||
|
||||
var factory = new ProjectDependenciesCommandFactory(
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
configuration,
|
||||
null,
|
||||
null,
|
||||
testInstance.TestRoot);
|
||||
|
||||
var command = factory.Create("dotnet-tool-with-output-name", null);
|
||||
|
||||
command.CommandArgs.Should().Contain(
|
||||
Path.Combine("ToolWithOutputName", "1.0.0", "lib", "netcoreapp1.0", "dotnet-tool-with-output-name.dll"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue