public void WithNoOptions_ReturnsHelp() { var processor = new CommandLineProcessor(new List <string>()); processor.Parse(new SampleDriver()); processor.OptionHelp.Should().HaveCount(c => c > 0); }
public void ForValidDriver_SetsShowHelp() { var arguments = new List <string> { "test-performance", "--help" }; var processor = new CommandLineProcessor(arguments); processor.Parse(new BaseDriver()); processor.ShowHelp.Should().BeTrue(); }
public void ForValidDriver_ReturnsText() { var arguments = new List <string> { "test-performance", "--help" }; var processor = new CommandLineProcessor(arguments); processor.Parse(new BaseDriver()); processor.OptionHelp.Should().NotBeEmpty(); }
public void WhenValidParameterIsMissingValue_ListsInvalidParameter() { var parameter = "--find"; var arguments = new List <string> { parameter }; var processor = new CommandLineProcessor(arguments); processor.Parse(new SampleDriver()).Execute(options => - 1); processor.Errors.Should().Contain(e => e.Contains(parameter)); }
public void ForInvalidParameter_ListsInvalidParameter() { var parameter = "--not-an-option"; var arguments = new List <string> { parameter }; var processor = new CommandLineProcessor(arguments); processor.Parse(new BaseDriver()).Execute(options => - 1); processor.Errors.Should().Contain(e => e.Contains(parameter)); }
public static int Main(string[] args) { _logger = new ConsoleLogger( ConsoleLoggerOptions.DisplayBanner | ConsoleLoggerOptions.UseLabels | ConsoleLoggerOptions.ShowTime); using (var processor = new CommandLineProcessor(args)) { processor.WithErrorAction(ShowErrors) .WithHelpAction(ShowHelp); return(processor.Parse <ProgramOptions>() .Execute(MainCore)); } }