public void CanUseElasticQueryParser() { var sut = new ElasticQueryParser(); var result = sut.Parse("NOT (dog parrot)"); Assert.IsType <GroupNode>(result.Left); Assert.True((result.Left as GroupNode).HasParens); Assert.True((result.Left as GroupNode).IsNegated); }
public void CanUseElasticQueryParserWithVisitor() { var testQueryVisitor = new TestQueryVisitor(); var sut = new ElasticQueryParser(c => c.AddQueryVisitor(testQueryVisitor)); var context = new ElasticQueryVisitorContext(); var result = sut.Parse("NOT (dog parrot)", context) as GroupNode; Assert.Equal(2, testQueryVisitor.GroupNodeCount); Assert.IsType <GroupNode>(result.Left); Assert.True((result.Left as GroupNode).HasParens); Assert.True((result.Left as GroupNode).IsNegated); }