예제 #1
0
        public void When_IgnoreUnknownArguments_is_set_valid_unknown_arguments_avoid_a_failure_parsing_for_verbs(
            string[] arguments,
            Commit_Verb expected)
        {
            // Fixture setup
            var sut = new Parser(config => config.IgnoreUnknownArguments = true);

            // Exercize system
            var result = sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(arguments);

            // Verify outcome
            result.Tag.ShouldBeEquivalentTo(ParserResultType.Parsed);
            result.WithParsed(opts => opts.ShouldBeEquivalentTo(expected));

            // Teardown
        }
예제 #2
0
        public void Parse_options_with_short_name_in_verbs_scenario(string message, string[] args)
        {
            // Fixture setup
            var expectedOptions = new Commit_Verb() { Message = message };
            var sut = new Parser();

            // Exercize system
            var result = sut.ParseArguments(
                args,
                typeof(Add_Verb), typeof(Commit_Verb), typeof(Clone_Verb));

            // Verify outcome
            Assert.IsType<Commit_Verb>(((Parsed<object>)result).Value);
            ((Parsed<object>)result).Value.ShouldBeEquivalentTo(expectedOptions, o => o.RespectingRuntimeTypes());
            // Teardown
        }