Show help info when no or wrong arguments are given

Fixes #5383, fixes #5384
This commit is contained in:
Mikkel Nylander Bundgaard 2017-05-04 01:01:35 +02:00
parent f3a4b22457
commit 18d71a8471
8 changed files with 124 additions and 4 deletions

View file

@ -27,6 +27,21 @@ Options:
-f, --framework <FRAMEWORK> Add reference only when targeting a specific framework
";
private const string AddCommandHelpText = @".NET Add Command
Usage: dotnet add [options] <PROJECT> [command]
Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
Options:
-h, --help Show help information
Commands:
package <PACKAGE_NAME> .NET Add Package reference Command
reference <args> .NET Add Project to Project reference Command
";
const string FrameworkNet451Arg = "-f net451";
const string ConditionFrameworkNet451 = "== 'net451'";
const string FrameworkNetCoreApp10Arg = "-f netcoreapp1.0";
@ -103,6 +118,7 @@ Options:
.ExecuteWithCapturedOutput($"add {commandName}");
cmd.Should().Fail();
cmd.StdErr.Should().Be("Required command was not provided.");
cmd.StdOut.Should().BeVisuallyEquivalentTo(AddCommandHelpText);
}
[Fact]