public void TestParsingFailedDueToTooFewArguments() { var cmdLine = setUpCommandLine(); var args = new[] { "load" }; var parsing = Cli.ParseInstructions(cmdLine, args); Assert.IsNull(parsing.Instructions); Assert.AreEqual(0, parsing.AcceptedArgs); var errorMsg = Cli.FormatParsingErrors(args, parsing.AcceptedArgs, parsing.Errors); var nl = System.Environment.NewLine; Assert.AreEqual( $"The command-line arguments could not be parsed.{nl}" + $"Arguments (vertically ordered):{nl}" + $"load <<< PROBLEM <<<{nl}" + nl + "Too few arguments specified for the command load. It requires at least one argument.", errorMsg); }
public void TestParsingFailedDueToAnUnknownCommand() { var cmdLine = setUpCommandLine(); var args = new[] { "load", "one", "unknown-command", "foobar" }; var parsing = Cli.ParseInstructions(cmdLine, args); Assert.IsNull(parsing.Instructions); var errorMsg = Cli.FormatParsingErrors(args, parsing.AcceptedArgs, parsing.Errors); var nl = System.Environment.NewLine; Assert.AreEqual( $"The command-line arguments could not be parsed.{nl}" + $"Arguments (vertically ordered):{nl}" + $"load{nl}" + $"one{nl}" + $"unknown-command <<< PROBLEM <<<{nl}" + $"foobar{nl}" + $"{nl}" + "Command unknown: unknown-command", errorMsg); }