Fixing a bug in the restore option where specifying verbosity through /v was not entirely honored.

Adding tests for implicit restore for all the affected commands.

Fixing an issue where the command target was being passed to the restore command during implicit restore.

Adding restore params to all commands with implicit restore. Also, implicitly set the restore output to quiet.

Adding tests for the no-restore option.
This commit is contained in:
Livar Cunha 2017-06-02 23:32:53 -07:00
parent dd76fec564
commit 3231295acf
14 changed files with 475 additions and 179 deletions

View file

@ -37,6 +37,40 @@ namespace Microsoft.DotNet.Cli.Run.Tests
.And.HaveStdOutContaining("Hello World!");
}
[Fact]
public void ItImplicitlyRestoresAProjectWhenRunning()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput()
.Should().Pass()
.And.HaveStdOutContaining("Hello World!");
}
[Fact]
public void ItDoesNotImplicitlyRestoreAProjectWhenRunningWithTheNoRestoreOption()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var testProjectDirectory = testInstance.Root.FullName;
new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--no-restore")
.Should().Fail()
.And.HaveStdOutContaining("project.assets.json' not found.");;
}
[Fact]
public void ItBuildsTheProjectBeforeRunning()
{
@ -160,7 +194,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
new RunCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput()
.ExecuteWithCapturedOutput("--no-restore")
.Should().Pass()
.And.HaveStdOutContaining("Hello World");
}