Exemplo n.º 1
0
        public void StartWith_GrammarWithUnresovedRules_ThrowsException()
        {
            var grammar = new AdHocGrammar();

            grammar.Sequence("start", grammar.Ref("item"));

            grammar.Invoking(g => g.StartWith("start")).Should().Throw <GrammarException>().Where(e => e.Id == GrammarExceptionId.GrammarContainsUnresolvedRule);
        }
Exemplo n.º 2
0
        public void Grammar_WithoutStartRule_ThrowsExceptionOnStart()
        {
            var grammar = new AdHocGrammar();

            grammar.TerminalType("A", "start");

            grammar.Invoking(g => g.Start()).Should().Throw <GrammarException>().Where(e => e.Id == GrammarExceptionId.StartRuleNotDefined);
        }