Esempio n. 1
0
        public void CommandExampleShowsOptionalArgWhenOptionsAreGiven()
        {
            ITemplateEngineHost host        = TestHost.GetVirtualHost(additionalComponents: BuiltInTemplatePackagesProviderFactory.GetComponents(includeTestTemplates: false));
            NewCommand          myCommand   = (NewCommand)NewCommandFactory.Create("new", _ => host, _ => new TelemetryLogger(null, false), new NewCommandCallbacks());
            Command             rootCommand = new Command("dotnet")
            {
                myCommand
            };

            var parseResult = rootCommand.Parse("dotnet new search template");

            Assert.Equal("dotnet new search [<template-name>] --author Microsoft", Example.For <NewCommand>(parseResult).WithSubcommand <SearchCommand>().WithArgument(SearchCommand.NameArgument).WithOption(SharedOptionsFactory.CreateAuthorOption(), "Microsoft"));
        }