public void CreateAdaptedILGenerator()
        {
            var factory         = new OffsetTrackingILGeneratorFactory();
            var realILGenerator = ILGeneratorObjectMother.Create();

            var result = factory.CreateAdaptedILGenerator(realILGenerator);

            Assert.That(result, Is.TypeOf <OffsetTrackingILGeneratorAdapter>());

            var offsetTrackingILGenerator = PrivateInvoke.GetNonPublicProperty(result, "ILGenerator");
            var innermostILGenerator      = PrivateInvoke.GetNonPublicField(offsetTrackingILGenerator, "_ilg");

            Assert.That(innermostILGenerator, Is.SameAs(realILGenerator));
        }
        public void CreateAdaptedILGenerator()
        {
            var realILGenerator = ILGeneratorObjectMother.Create();

            var fakeInnerResult = new Mock <IILGenerator>().Object;

            _innerFactoryStub.Setup(stub => stub.CreateAdaptedILGenerator(realILGenerator)).Returns(fakeInnerResult);

            var ilGenerator = _decoratorFactory.CreateAdaptedILGenerator(realILGenerator);

            Assert.That(ilGenerator, Is.TypeOf <ILGeneratorDecorator>());
            var ilGeneratorDecorator = (ILGeneratorDecorator)ilGenerator;

            Assert.That(ilGeneratorDecorator.InnerILGenerator, Is.SameAs(fakeInnerResult));
            Assert.That(ilGeneratorDecorator.EmittableOperandProvider, Is.SameAs(_emittableOperandProviderMock.Object));
        }