public void AcceptMethodCallsOnlyVisitOnVisitorWithThisAndNoOtherVisitMethods() { var lhs = new ConstantExpr(1); var rhs = new ConstantExpr(2); var target = new MultExpr(lhs, rhs); // throw exception is any other methods called other than the MultExpr overload. var visitor = new Mock<IExpressionVisitor<string, int>>(MockBehavior.Strict); visitor.Setup(x => x.Visit(It.IsAny<MultExpr>(), It.IsAny<int>())).Returns(""); target.Accept(visitor.Object, 2); }
public void AcceptMethodCallsVisitOnVisitorWithThis() { var lhs = new ConstantExpr(1); var rhs = new ConstantExpr(2); var target = new MultExpr(lhs, rhs); 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 lhs = new ConstantExpr(1); var rhs = new ConstantExpr(2); var target = new MultExpr(lhs, rhs); 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 lhs = new ConstantExpr(1); var rhs = new ConstantExpr(2); var target = new MultExpr(lhs, rhs); // throw exception is any other methods called other than the MultExpr overload. var visitor = new Mock <IExpressionVisitor <string, int> >(MockBehavior.Strict); visitor.Setup(x => x.Visit(It.IsAny <MultExpr>(), It.IsAny <int>())).Returns(""); target.Accept(visitor.Object, 2); }