Add functional test for dependency commands
This commit is contained in:
parent
0f21184bf6
commit
139911b8b3
2 changed files with 52 additions and 1 deletions
|
@ -48,6 +48,36 @@ namespace Microsoft.DotNet.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(".NETStandardApp,Version=v1.5")]
|
||||||
|
[InlineData(".NETFramework,Version=v4.5.1")]
|
||||||
|
public void TestFrameworkSpecificDependencyToolsCanBeInvoked(string framework)
|
||||||
|
{
|
||||||
|
var appDirectory = Path.Combine(_testProjectsRoot, "AppWithDirectDependencyDesktopAndPortable");
|
||||||
|
|
||||||
|
new BuildCommand(Path.Combine(appDirectory, "project.json"))
|
||||||
|
.Execute()
|
||||||
|
.Should()
|
||||||
|
.Pass();
|
||||||
|
|
||||||
|
var currentDirectory = Directory.GetCurrentDirectory();
|
||||||
|
Directory.SetCurrentDirectory(appDirectory);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CommandResult result = new DependencyToolInvokerCommand()
|
||||||
|
.ExecuteWithCapturedOutput(framework);
|
||||||
|
|
||||||
|
result.Should().HaveStdOutContaining(framework);
|
||||||
|
result.Should().NotHaveStdErr();
|
||||||
|
result.Should().Pass();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Directory.SetCurrentDirectory(currentDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestProjectDependencyIsNotAvailableThroughDriver()
|
public void TestProjectDependencyIsNotAvailableThroughDriver()
|
||||||
{
|
{
|
||||||
|
@ -114,5 +144,25 @@ namespace Microsoft.DotNet.Tests
|
||||||
return base.ExecuteWithCapturedOutput(args);
|
return base.ExecuteWithCapturedOutput(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DependencyToolInvokerCommand : TestCommand
|
||||||
|
{
|
||||||
|
public DependencyToolInvokerCommand()
|
||||||
|
: base("dotnet")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override CommandResult Execute(string framework)
|
||||||
|
{
|
||||||
|
var args = $"dependency-tool-invoker desktop-and-portable --framework {framework}";
|
||||||
|
return base.Execute(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override CommandResult ExecuteWithCapturedOutput(string framework)
|
||||||
|
{
|
||||||
|
var args = $"dependency-tool-invoker desktop-and-portable --framework {framework}";
|
||||||
|
return base.ExecuteWithCapturedOutput(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@
|
||||||
"content": [
|
"content": [
|
||||||
"../../TestAssets/TestProjects/AppWithDirectAndToolDependency/**/*",
|
"../../TestAssets/TestProjects/AppWithDirectAndToolDependency/**/*",
|
||||||
"../../TestAssets/TestProjects/AppWithDirectDependency/**/*",
|
"../../TestAssets/TestProjects/AppWithDirectDependency/**/*",
|
||||||
"../../TestAssets/TestProjects/AppWithToolDependency/**/*"
|
"../../TestAssets/TestProjects/AppWithToolDependency/**/*",
|
||||||
|
"../../TestAssets/TestProjects/AppWithDirectDependencyDesktopAndPortable/**/*"
|
||||||
],
|
],
|
||||||
"testRunner": "xunit"
|
"testRunner": "xunit"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue