Example #1
0
        public void AcceptMethodCallsVisitOnVisitorWithThis()
        {
            var target = new ReturnStmt(new ConstantExpr(8484));
            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 AcceptMethodCallsVisitOnVisitorWithThis()
        {
            var target  = new ReturnStmt(new ConstantExpr(8484));
            var visitor = new Mock <IExpressionVisitor <string, int> >();

            target.Accept(visitor.Object, 0);

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

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

            visitor.Setup(x => x.Visit(target, 0)).Returns("");

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