Ejemplo n.º 1
0
            public void AcceptMethodCallsOnlyVisitOnVisitorWithThisAndNoOtherVisitMethods()
            {
                var lhs = new ConstantExpr(1);
                var rhs = new ConstantExpr(2);

                var target = new MinusExpr(lhs, rhs);
                // throw exception is any other methods called other than the MinusExpr overload.
                var visitor = new Mock<IExpressionVisitor<string, int>>(MockBehavior.Strict);
                visitor.Setup(x => x.Visit(It.IsAny<MinusExpr>(), It.IsAny<int>())).Returns("");

                target.Accept(visitor.Object,0);
            }
Ejemplo n.º 2
0
            public void AcceptMethodCallsVisitOnVisitorWithThis()
            {
                var lhs = new ConstantExpr(1);
                var rhs = new ConstantExpr(2);

                var target = new MinusExpr(lhs, rhs);
                var visitor = new Mock<IExpressionVisitor<string, int>>();

                target.Accept(visitor.Object,0);

                visitor.Verify(x => x.Visit(target,0), Times.Once);
            }
Ejemplo n.º 3
0
            public void AcceptMethodCallsVisitOnVisitorWithThis()
            {
                var lhs = new ConstantExpr(1);
                var rhs = new ConstantExpr(2);

                var target  = new MinusExpr(lhs, rhs);
                var visitor = new Mock <IExpressionVisitor <string, int> >();

                target.Accept(visitor.Object, 0);

                visitor.Verify(x => x.Visit(target, 0), Times.Once);
            }
Ejemplo n.º 4
0
            public void AcceptMethodCallsOnlyVisitOnVisitorWithThisAndNoOtherVisitMethods()
            {
                var lhs = new ConstantExpr(1);
                var rhs = new ConstantExpr(2);

                var target = new MinusExpr(lhs, rhs);
                // throw exception is any other methods called other than the MinusExpr overload.
                var visitor = new Mock <IExpressionVisitor <string, int> >(MockBehavior.Strict);

                visitor.Setup(x => x.Visit(It.IsAny <MinusExpr>(), It.IsAny <int>())).Returns("");

                target.Accept(visitor.Object, 0);
            }