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); }
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); }
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); }
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); }