public void MethodInfoClosedInGenTypeNongenMethodValueTypeRefType()
        {
            KeepDataInterceptor interceptor = new KeepDataInterceptor();
            GenClassWithGenReturn <int, List <object> > proxy = generator.CreateClassProxy <
                GenClassWithGenReturn <int, List <object> >
                >(interceptor);

            proxy.DoSomethingT();
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethod(),
                typeof(int)
                );
            Assert.AreEqual(
                interceptor.Invocation.GetConcreteMethod(),
                interceptor.Invocation.GetConcreteMethodInvocationTarget().GetBaseDefinition()
                );

            proxy.DoSomethingZ();
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethod(),
                typeof(List <object>)
                );
            Assert.AreEqual(
                interceptor.Invocation.GetConcreteMethod(),
                interceptor.Invocation.GetConcreteMethodInvocationTarget().GetBaseDefinition()
                );
        }
Exemple #2
0
        public void MethodInfoClosedInGenTypeNongenMethodRefTypeRefType()
        {
            KeepDataInterceptor interceptor = new KeepDataInterceptor();
            GenClassWithGenReturn <List <object>, List <object> > proxy =
                generator.CreateClassProxy <GenClassWithGenReturn <List <object>, List <object> > >(interceptor);

            proxy.DoSomethingT();
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(List <object>));

            proxy.DoSomethingZ();
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(List <object>));
        }
Exemple #3
0
        public void ProxyWithGenericArgumentsAndMethodGenericReturn()
        {
            GenClassWithGenReturn <List <object>, List <object> > proxy =
                generator.CreateClassProxy <GenClassWithGenReturn <List <object>, List <object> > >(logger);

            Assert.IsNotNull(proxy);

            object ret1 = proxy.DoSomethingT();
            object ret2 = proxy.DoSomethingZ();

            Assert.IsInstanceOf(typeof(List <object>), ret1);
            Assert.IsInstanceOf(typeof(List <object>), ret2);
            Assert.AreEqual("DoSomethingT DoSomethingZ ", logger.LogContents);
        }