public void AcceptMethodCallsVisitOnVisitorWithThis()
            {
                var name       = new IdentifierExpr(RandomGenerator.String());
                var arguments  = new VarDefinitionStmt[0];
                var body       = new NoOpStatement();
                var returnType = new IdentifierExpr(RandomGenerator.String());

                var target = new FunctionDefinitionExpr(name, arguments, body, returnType);

                var visitor = new Mock <IExpressionVisitor <string, int> >();

                target.Accept(visitor.Object, 0);

                visitor.Verify(x => x.Visit(target, 0), Times.Once);
            }
            public void AcceptMethodCallsOnlyVisitOnVisitorWithThisAndNoOtherVisitMethods()
            {
                var name       = new IdentifierExpr(RandomGenerator.String());
                var arguments  = new VarDefinitionStmt[0];
                var body       = new NoOpStatement();
                var returnType = new IdentifierExpr(RandomGenerator.String());

                var target = new FunctionDefinitionExpr(name, arguments, body, returnType);

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

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

                target.Accept(visitor.Object, 1234);
            }
            public void AcceptMethodCallsOnlyVisitOnVisitorWithThisAndNoOtherVisitMethods()
            {
                var name = new IdentifierExpr(RandomGenerator.String());
                var arguments = new VarDefinitionStmt[0];
                var body = new NoOpStatement();
                var returnType = new IdentifierExpr(RandomGenerator.String());

                var target = new FunctionDefinitionExpr(name, arguments, body, returnType);

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

                target.Accept(visitor.Object, 1234);
            }
            public void AcceptMethodCallsVisitOnVisitorWithThis()
            {
                var name = new IdentifierExpr(RandomGenerator.String());
                var arguments = new VarDefinitionStmt[0];
                var body = new NoOpStatement();
                var returnType = new IdentifierExpr(RandomGenerator.String());

                var target = new FunctionDefinitionExpr(name, arguments, body, returnType);

                var visitor = new Mock<IExpressionVisitor<string, int>>();

                target.Accept(visitor.Object, 0);

                visitor.Verify(x => x.Visit(target, 0), Times.Once);
            }