예제 #1
0
        public void Add_New_Parsers_To_All_Necessary_Repositories()
        {
            // arrange
            var builder = new ContextBuilder();

            // act
            builder.AddParser("base");

            // assert
            builder.ParserRepository.Parsers.Should().HaveCount(1);
            builder.HierarchyRepository.Nodes.Should().HaveCount(1);
        }
예제 #2
0
        public void Allow_Help_To_Be_Set_When_Adding()
        {
            // arrange
            var builder = new ContextBuilder();

            // act
            var parserBuilder = builder.AddParser("a",
                                                  help => { help.SetName("Something").SetShortDescription("Does something"); });

            // assert
            parserBuilder.Parser.Help.Name.Should().Be("Something");
            parserBuilder.Parser.Help.ShortDescription.Should().Be("Does something");
        }
예제 #3
0
        public void Set_Switch_Tokens_For_Newly_Created_Parsers1()
        {
            // arrange
            var builder = new ContextBuilder();

            builder.SetSwitchTokens("#", "##");
            builder
            .AddParser("a", help => { help.SetName("hi"); })
            .WithBooleanSwitch('h', "help", o => { });


            // act
            // assert
            var parser = builder.Context.ParserRepository.Get("a");
            var param  = parser.Parameters.OfType <Switch>().Single();

            param.LetterToken.Should().Be("#");
            param.WordToken.Should().Be("##");
        }