예제 #1
0
        public void OrNode_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();

            OrNode orNode = new OrNode
            {
                First  = first.Object,
                Second = second.Object
            };

            orNode.Accept(visitor.Object);

            visitor.VerifyAll();
            first.Verify();
            second.Verify();
        }
        public void Should_return_composite_descriptor_for_or_node()
        {
            OrNode orNode = new OrNode()
            {
                First = DateTimeComparison(),
                Second = StringFunction()
            };

            orNode.Accept(visitor);

            CompositeFilterDescriptor descriptor = (CompositeFilterDescriptor)visitor.Result;
            Assert.Equal(FilterCompositionLogicalOperator.Or, descriptor.LogicalOperator);
            Assert.Equal(FilterOperator.IsEqualTo, ((FilterDescriptor)descriptor.FilterDescriptors[0]).Operator);
            Assert.Equal(FilterOperator.StartsWith, ((FilterDescriptor)descriptor.FilterDescriptors[1]).Operator);
        }
        public void Should_return_composite_descriptor_for_or_node()
        {
            OrNode orNode = new OrNode()
            {
                First  = DateTimeComparison(),
                Second = StringFunction()
            };

            orNode.Accept(visitor);

            CompositeFilterDescriptor descriptor = (CompositeFilterDescriptor)visitor.Result;

            Assert.Equal(FilterCompositionLogicalOperator.Or, descriptor.LogicalOperator);
            Assert.Equal(FilterOperator.IsEqualTo, ((FilterDescriptor)descriptor.FilterDescriptors[0]).Operator);
            Assert.Equal(FilterOperator.StartsWith, ((FilterDescriptor)descriptor.FilterDescriptors[1]).Operator);
        }
 public void Visit(OrNode node)
 {
     node.Left.Accept(this);
     node.Right.Accept(this);
     node.Accept(_visitor);
 }
예제 #5
0
 public virtual void Visit(OrNode node)
 {
     node.Left.Accept(this);
     node.Right.Accept(this);
     node.Accept(Visitor);
 }