Example #1
0
        public void AcceptMethodCallsVisitOnVisitorWithThis()
        {
            var target = new ConstantExpr(1357);
            var visitor = new Mock<IExpressionVisitor<string, int>>();

            target.Accept(visitor.Object, 0);

            visitor.Verify(x => x.Visit(target, 0), Times.Once);
        }
Example #2
0
        public void AcceptMethodCallsOnlyVisitOnVisitorWithThisAndNoOtherVisitMethods()
        {
            var target = new ConstantExpr(1357);
            // throw exception is any other methods called other than the ConstantExpr overload.
            var visitor = new Mock<IExpressionVisitor<string, int>>(MockBehavior.Strict);
            visitor.Setup(x => x.Visit(It.IsAny<ConstantExpr>(), It.IsAny<int>())).Returns("");

            target.Accept(visitor.Object, 0);
        }
Example #3
0
        public void AcceptMethodCallsVisitOnVisitorWithThis()
        {
            var target  = new ConstantExpr(1357);
            var visitor = new Mock <IExpressionVisitor <string, int> >();

            target.Accept(visitor.Object, 0);

            visitor.Verify(x => x.Visit(target, 0), Times.Once);
        }
Example #4
0
        public void AcceptMethodCallsOnlyVisitOnVisitorWithThisAndNoOtherVisitMethods()
        {
            var target = new ConstantExpr(1357);
            // throw exception is any other methods called other than the ConstantExpr overload.
            var visitor = new Mock <IExpressionVisitor <string, int> >(MockBehavior.Strict);

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

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