Esempio n. 1
0
        void should_throw_invalidOperationException_error_when_define_default_command_secondly()
        {
            var fullName1     = "flag";
            var abbreviation1 = 'f';
            var parser        = new ArgsParserBuilder();

            parser.BeginDefaultCommand().AddFlagOption(fullName1, abbreviation1, String.Empty)
            .EndCommand();

            Assert.Throws <InvalidOperationException>(() => parser.BeginDefaultCommand());
        }
Esempio n. 2
0
        public void should_throw_if_default_command_has_been_set()
        {
            ArgsParserBuilder builder = new ArgsParserBuilder()
                                        .BeginDefaultCommand()
                                        .EndCommand();

            Assert.Throws <InvalidOperationException>(() => builder.BeginDefaultCommand().EndCommand());
        }
Esempio n. 3
0
        void should_throw_InvalidOperationException_when_default_command_already_defined()
        {
            var builderAlreadyWithDefaultCommand = new ArgsParserBuilder().BeginDefaultCommand().EndCommand();
            var builderDefineDefaultCommandAgain = builderAlreadyWithDefaultCommand.BeginDefaultCommand();

            Assert.Equal("Default Command is arleady defined",
                         Assert.Throws <InvalidOperationException>(() => builderDefineDefaultCommandAgain.EndCommand()).Message);
        }
Esempio n. 4
0
        void should_build_a_parser_successfully_after_ending_command()
        {
            builder.BeginDefaultCommand().EndCommand();

            Assert.Null(Record.Exception(() => builder.Build()));
        }
 void should_begin_default_command_successfully()
 {
     Assert.Null(Record.Exception(() => builder.BeginDefaultCommand()));
 }