Beispiel #1
0
        public void DeclareLocal()
        {
            var localVariableType    = ReflectionObjectMother.GetSomeType();
            var fakeEmittableOperand = MockRepository.GenerateStub <Type>();
            var fakeLocalBuilder     = ReflectionEmitObjectMother.GetSomeLocalBuilder();

            _emittableOperandProviderStub.Stub(stub => stub.GetEmittableType(localVariableType)).Return(fakeEmittableOperand);

            _innerILGeneratorMock.Expect(mock => mock.DeclareLocal(fakeEmittableOperand)).Return(fakeLocalBuilder);

            var result = _decorator.DeclareLocal(localVariableType);

            _innerILGeneratorMock.VerifyAllExpectations();
            Assert.That(result, Is.SameAs(fakeLocalBuilder));
        }
        public void DeclareLocal()
        {
            var localVariableType    = ReflectionObjectMother.GetSomeType();
            var fakeEmittableOperand = new Mock <Type>().Object;
            var fakeLocalBuilder     = ReflectionEmitObjectMother.GetSomeLocalBuilder();

            _emittableOperandProviderStub.Setup(stub => stub.GetEmittableType(localVariableType)).Returns(fakeEmittableOperand);

            _innerILGeneratorMock.Setup(mock => mock.DeclareLocal(fakeEmittableOperand)).Returns(fakeLocalBuilder).Verifiable();

            var result = _decorator.DeclareLocal(localVariableType);

            _innerILGeneratorMock.Verify();
            Assert.That(result, Is.SameAs(fakeLocalBuilder));
        }