public void DefaultCommand_ShouldReturnNewDefaultCommandSetup() { var parser = A.Fake <Parser>(); var commandParser = A.Fake <CommandParser <Command1Options> >(); var commandSetup = A.Fake <DefaultCommandSetup <Command1Options> >(); var setup = new ParserSetup(parser); A.CallTo(() => parser.GetOrCreateCommandParser <Command1Options>(null)).Returns(commandParser); A.CallTo(() => this.DependencyResolver.Resolve <DefaultCommandSetup <Command1Options> >(parser, commandParser)).Returns(commandSetup); setup.DefaultCommand <Command1Options>().Should().Be(commandSetup); }
public static void SetupCommand(ParserSetup parserSetup) { var defaultCommand = parserSetup .DefaultCommand <QueryWebCommandOptions>() .Help("Downloads and shows a website on the console and performs a search engine search.") .ExampleUsage("Toolbox --search What is life"); defaultCommand .Option(a => a.WebsiteAddress) .Name("website") .Help("The HTTP address of a website to download an show."); defaultCommand .Option(a => a.SearchEngineQuery) .Name("search") .Help("A search query to ask a search engine."); defaultCommand.Validate(Validate); }