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 MethodInfoClosedInGenIfcGenMethodRefTypeNoTarget()
        {
            var interceptor = new KeepDataInterceptor();
            var proxy       = generator.CreateInterfaceProxyWithoutTarget <
                GenInterfaceWithGenMethods <List <object> >
                >(interceptor);

            proxy.DoSomething(1, null);
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethod(),
                typeof(void),
                typeof(int),
                typeof(List <object>)
                );
            Assert.AreEqual(null, interceptor.Invocation.GetConcreteMethodInvocationTarget());

            proxy.DoSomething(new List <object>(), new List <object>());
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethod(),
                typeof(void),
                typeof(List <object>),
                typeof(List <object>)
                );
            Assert.AreEqual(null, interceptor.Invocation.GetConcreteMethodInvocationTarget());
        }
        public void MethodInfoClosedInNongenIfcGenMethodNoTarget()
        {
            var interceptor = new KeepDataInterceptor();
            var proxy       = generator.CreateInterfaceProxyWithoutTarget <OnlyGenMethodsInterface>(interceptor);

            proxy.DoSomething(1);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(int), typeof(int));

            proxy.DoSomething(new List <object>());
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(List <object>),
                                                       typeof(List <object>));
        }
        public void MethodInfoClosedInGenIfcNongenMethodValueTypeNoTarget()
        {
            var interceptor = new KeepDataInterceptor();
            var proxy       =
                generator.CreateInterfaceProxyWithoutTarget <IGenInterfaceHierarchyBase <int> >(interceptor);

            proxy.Get();
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(int));

            proxy.Add(0);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(void), typeof(int));
        }
Exemple #5
0
        public void MethodInfoClosedInNongenTypeGenMethod()
        {
            KeepDataInterceptor interceptor = new KeepDataInterceptor();
            OnlyGenMethodsClass proxy       = generator.CreateClassProxy <OnlyGenMethodsClass>(interceptor);

            proxy.DoSomething(1);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(int), typeof(int));

            proxy.DoSomething(new List <object>());
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(List <object>),
                                                       typeof(List <object>));
        }
Exemple #6
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>));
        }
        public void MethodInfoClosedInGenIfcNongenMethodRefTypeNoTarget()
        {
            KeepDataInterceptor interceptor = new KeepDataInterceptor();
            IGenInterfaceHierarchyBase <List <object> > proxy =
                generator.CreateInterfaceProxyWithoutTarget <IGenInterfaceHierarchyBase <List <object> > >(interceptor);

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

            proxy.Add(null);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(void),
                                                       typeof(List <object>));
        }
        public void MethodInfoClosedInGenIfcGenMethodValueTypeNoTarget()
        {
            KeepDataInterceptor interceptor        = new KeepDataInterceptor();
            GenInterfaceWithGenMethods <int> proxy =
                generator.CreateInterfaceProxyWithoutTarget <GenInterfaceWithGenMethods <int> >(interceptor);

            proxy.DoSomething(1, 1);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(void), typeof(int),
                                                       typeof(int));

            proxy.DoSomething(new List <object>(), 1);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(void),
                                                       typeof(List <object>), typeof(int));
        }
Exemple #9
0
        public void MethodInfoClosedInGenIfcGenMethodValueTypeWithTarget()
        {
            var interceptor = new KeepDataInterceptor();
            GenInterfaceWithGenMethods <int> target = new GenInterfaceWithGenMethodsImpl <int>();
            var proxy = generator.CreateInterfaceProxyWithTarget(target, interceptor);

            proxy.DoSomething(1, 1);
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethod(),
                typeof(void),
                typeof(int),
                typeof(int)
                );
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethodInvocationTarget(),
                typeof(void),
                typeof(int),
                typeof(int)
                );
            Assert.AreNotEqual(
                interceptor.Invocation.GetConcreteMethod(),
                interceptor.Invocation.GetConcreteMethodInvocationTarget()
                );

            proxy.DoSomething(new List <object>(), 1);
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethod(),
                typeof(void),
                typeof(List <object>),
                typeof(int)
                );
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethodInvocationTarget(),
                typeof(void),
                typeof(List <object>),
                typeof(int)
                );
            Assert.AreNotEqual(
                interceptor.Invocation.GetConcreteMethod(),
                interceptor.Invocation.GetConcreteMethodInvocationTarget()
                );
        }
        public void MethodInfoClosedInGenIfcNongenMethodValueTypeWithTarget()
        {
            var interceptor = new KeepDataInterceptor();
            IGenInterfaceHierarchyBase <int> target = new GenInterfaceHierarchy <int>();
            var proxy =
                generator.CreateInterfaceProxyWithTarget(target, interceptor);

            proxy.Add(0);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(void), typeof(int));
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethodInvocationTarget(), typeof(void),
                                                       typeof(int));
            Assert.AreNotEqual(interceptor.Invocation.GetConcreteMethod(),
                               interceptor.Invocation.GetConcreteMethodInvocationTarget());

            proxy.Get();
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(int));
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethodInvocationTarget(), typeof(int));
            Assert.AreNotEqual(interceptor.Invocation.GetConcreteMethod(),
                               interceptor.Invocation.GetConcreteMethodInvocationTarget());
        }
        public void MethodInfoClosedInNongenIfcGenMethodWithTarget()
        {
            KeepDataInterceptor     interceptor = new KeepDataInterceptor();
            OnlyGenMethodsInterface target      = new OnlyGenMethodsInterfaceImpl();
            OnlyGenMethodsInterface proxy       =
                generator.CreateInterfaceProxyWithTarget <OnlyGenMethodsInterface>(target, interceptor);

            proxy.DoSomething(1);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(int), typeof(int));
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethodInvocationTarget(), typeof(int),
                                                       typeof(int));
            Assert.AreNotEqual(interceptor.Invocation.GetConcreteMethod(),
                               interceptor.Invocation.GetConcreteMethodInvocationTarget());

            proxy.DoSomething(new List <object>());
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(List <object>),
                                                       typeof(List <object>));
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethodInvocationTarget(),
                                                       typeof(List <object>), typeof(List <object>));
            Assert.AreNotEqual(interceptor.Invocation.GetConcreteMethod(),
                               interceptor.Invocation.GetConcreteMethodInvocationTarget());
        }