コード例 #1
0
        public void DefineGenericParameters()
        {
            var genericParameterNames           = new[] { "T1", "T2" };
            var fakeGenericTypeParameterBuilder = MockRepository.GenerateStub <IGenericTypeParameterBuilder>();

            _innerMock.Expect(mock => mock.DefineGenericParameters(genericParameterNames)).Return(new[] { fakeGenericTypeParameterBuilder });

            var results = _decorator.DefineGenericParameters(genericParameterNames);

            var result = results.Single();

            Assert.That(result, Is.TypeOf <GenericTypeParameterBuilderDecorator>());
            // Use field from base class 'BuilderDecoratorBase'.
            Assert.That(PrivateInvoke.GetNonPublicField(result, "_customAttributeTargetBuilder"), Is.SameAs(fakeGenericTypeParameterBuilder));
        }