Exemple #1
0
        public void Emit_ConstructorInfo()
        {
            var constructor          = ReflectionObjectMother.GetSomeConstructor();
            var fakeEmittableOperand = MockRepository.GenerateStub <ConstructorInfo>();

            _emittableOperandProviderStub.Stub(stub => stub.GetEmittableConstructor(constructor)).Return(fakeEmittableOperand);

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

            _decorator.Emit(OpCodes.Call, constructor);

            _innerILGeneratorMock.VerifyAllExpectations();
        }
        public void Emit_ConstructorInfo()
        {
            var constructor          = ReflectionObjectMother.GetSomeConstructor();
            var fakeEmittableOperand = new Mock <ConstructorInfo>().Object;

            _emittableOperandProviderStub.Setup(stub => stub.GetEmittableConstructor(constructor)).Returns(fakeEmittableOperand);

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

            _decorator.Emit(OpCodes.Call, constructor);

            _innerILGeneratorMock.Verify();
        }