Esempio n. 1
0
        public void EmitCall_MethodInfo()
        {
            var method = ReflectionObjectMother.GetSomeMethod();
            var optionalParameterTypes = new[] { ReflectionObjectMother.GetSomeType() };
            var fakeEmittableOperand   = MockRepository.GenerateStub <MethodInfo> ();

            _emittableOperandProviderStub.Stub(stub => stub.GetEmittableMethod(method)).Return(fakeEmittableOperand);

            _innerILGeneratorMock.Expect(mock => mock.EmitCall(OpCodes.Call, fakeEmittableOperand, optionalParameterTypes));

            _decorator.EmitCall(OpCodes.Call, method, optionalParameterTypes);

            _innerILGeneratorMock.VerifyAllExpectations();
        }
        public void EmitCall_MethodInfo()
        {
            var method = ReflectionObjectMother.GetSomeMethod();
            var optionalParameterTypes = new[] { ReflectionObjectMother.GetSomeType() };
            var fakeEmittableOperand   = new Mock <MethodInfo>().Object;

            _emittableOperandProviderStub.Setup(stub => stub.GetEmittableMethod(method)).Returns(fakeEmittableOperand);

            _innerILGeneratorMock.Setup(mock => mock.EmitCall(OpCodes.Call, fakeEmittableOperand, optionalParameterTypes)).Verifiable();

            _decorator.EmitCall(OpCodes.Call, method, optionalParameterTypes);

            _innerILGeneratorMock.Verify();
        }