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