Exemplo n.º 1
0
        public void Setting_help_writer_using_constructor()
        {
            var writer = new StringWriter();
            IParser parser = new Parser(new ParserSettings(writer));
            var options = new SimpleOptionsWithHelpOption();

            bool success = parser.ParseArguments(new string[] {"--help"}, options);

            success.Should().BeFalse();
            writer.ToString().Should().Be("MockOptions::GetUsage()");
        }
Exemplo n.º 2
0
        public void Setting_help_writer_using_property()
        {
            var writer = new StringWriter();
            var settings = new ParserSettings();
            settings.HelpWriter = writer;
            var parser = new CommandLine.Parser(settings);
            var options = new SimpleOptionsWithHelpOption();

            bool success = parser.ParseArguments(new string[] { "--help" }, options);

            success.Should().BeFalse();
            writer.ToString().Should().Be("MockOptions::GetUsage()");
        }