public void AndNode_should_accept_visitor() { visitor.Setup(v => v.StartVisit(It.IsAny <ILogicalNode>())).Verifiable(); visitor.Setup(v => v.EndVisit()).Verifiable(); Mock <IFilterNode> first = new Mock <IFilterNode>(); first.Setup(f => f.Accept(It.IsAny <IFilterNodeVisitor>())).Verifiable(); Mock <IFilterNode> second = new Mock <IFilterNode>(); second.Setup(f => f.Accept(It.IsAny <IFilterNodeVisitor>())).Verifiable(); AndNode andNode = new AndNode { First = first.Object, Second = second.Object }; andNode.Accept(visitor.Object); visitor.VerifyAll(); first.Verify(); second.Verify(); }
public void Should_return_composite_descriptor_for_and_node() { AndNode andNode = new AndNode() { First = DateTimeComparison(), Second = StringFunction() }; andNode.Accept(visitor); CompositeFilterDescriptor descriptor = (CompositeFilterDescriptor)visitor.Result; Assert.Equal(FilterCompositionLogicalOperator.And, descriptor.LogicalOperator); Assert.Equal(FilterOperator.IsEqualTo, ((FilterDescriptor)descriptor.FilterDescriptors[0]).Operator); Assert.Equal(FilterOperator.StartsWith, ((FilterDescriptor)descriptor.FilterDescriptors[1]).Operator); }
public void Visit(AndNode node) { node.Left.Accept(this); node.Right.Accept(this); node.Accept(_visitor); }