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); }
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); }