public void VisitBox() { var expression = ExpressionTreeObjectMother.GetSomeBoxAndCastExpression(); Assert.That(expression.Type, Is.Not.SameAs(expression.Operand.Type)); _childExpressionEmitterMock.Setup(mock => mock.EmitChildExpression(expression.Operand)).Verifiable(); _ilGeneratorMock.Setup(mock => mock.Emit(OpCodes.Box, expression.Operand.Type)).Verifiable(); _ilGeneratorMock.Setup(mock => mock.Emit(OpCodes.Castclass, expression.Type)).Verifiable(); var result = _emitter.VisitBox(expression); _childExpressionEmitterMock.Verify(); _ilGeneratorMock.Verify(); Assert.That(result, Is.SameAs(expression)); }