Add verbosity option to run command.

This commit adds the verbosity option to the run command.

This will be used in tests for visibility into what the run command is
doing.

The default verbosity is unaffected.

Fixes issue #7932.
This commit is contained in:
Peter Huene 2017-11-27 23:03:33 -08:00
parent 40b0e0fcec
commit ea85555a97
2 changed files with 24 additions and 1 deletions

View file

@ -51,7 +51,8 @@ namespace Microsoft.DotNet.Cli
"--no-build",
LocalizableStrings.CommandOptionNoBuildDescription,
Accept.NoArguments()),
CommonOptions.NoRestoreOption()
CommonOptions.NoRestoreOption(),
CommonOptions.VerbosityOption()
});
}
}

View file

@ -518,5 +518,27 @@ namespace Microsoft.DotNet.Cli.Run.Tests
.And.HaveStdOutContaining("(NO MESSAGE)")
.And.HaveStdErrContaining(string.Format(LocalizableStrings.RunCommandExceptionCouldNotApplyLaunchSettings, LocalizableStrings.DefaultLaunchProfileDisplayName, "").Trim());
}
[Fact]
public void ItRunsWithTheSpecifiedVerbosity()
{
var testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles();
var result = new RunCommand()
.WithWorkingDirectory( testInstance.Root.FullName)
.ExecuteWithCapturedOutput("-v:n");
result.Should().Pass()
.And.HaveStdOutContaining("Hello World!");
if (!DotnetUnderTest.IsLocalized())
{
result.Should().HaveStdOutContaining("Restore")
.And.HaveStdOutContaining("CoreCompile");
}
}
}
}