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