public void GetHelpDetails_WithEmptyParseResultSection_ReturnsNull() { ArrangeInputs(parseResultSections: string.Empty, out MockedShellState shellState, out HttpState httpState, out ICoreParseResult parseResult); RunCommand runCommand = new RunCommand(new MockedFileSystem()); string result = runCommand.GetHelpDetails(shellState, httpState, parseResult); Assert.Null(result); }
public void GetHelpDetails_WithFirstParseResultSectionNotEqualToName_ReturnsNull() { ArrangeInputs(parseResultSections: "section1 section2 section3", out MockedShellState shellState, out HttpState httpState, out ICoreParseResult parseResult); RunCommand runCommand = new RunCommand(new MockedFileSystem()); string result = runCommand.GetHelpDetails(shellState, httpState, parseResult); Assert.Null(result); }
public void GetHelpDetails_WithValidInput_HelpDetails() { ArrangeInputs(parseResultSections: "run InputFileForRunCommand.txt", out MockedShellState shellState, out HttpState httpState, out ICoreParseResult parseResult); string expected = "\u001b[1mUsage: \u001b[39mrun {path to script}" + Environment.NewLine + Environment.NewLine + "Runs the specified script." + Environment.NewLine + "A script is a text file containing one CLI command per line. Each line will be run as if it was typed into the CLI." + Environment.NewLine + Environment.NewLine + "When +history option is specified, commands specified in the text file will be added to command history." + Environment.NewLine; RunCommand runCommand = new RunCommand(new MockedFileSystem()); string result = runCommand.GetHelpDetails(shellState, httpState, parseResult); Assert.Equal(expected, result); }