CheckMethodInfoIsClosed() public static method

public static CheckMethodInfoIsClosed ( MethodInfo method, Type returnType ) : void
method System.Reflection.MethodInfo
returnType System.Type
return void
Ejemplo n.º 1
0
        public void MethodInfoClosedInGenTypeNongenMethodValueTypeValueType()
        {
            KeepDataInterceptor interceptor        = new KeepDataInterceptor();
            GenClassWithGenReturn <int, int> proxy = generator.CreateClassProxy <GenClassWithGenReturn <int, int> >(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(int));
            Assert.AreEqual(interceptor.Invocation.GetConcreteMethod(),
                            interceptor.Invocation.GetConcreteMethodInvocationTarget().GetBaseDefinition());
        }
        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());
        }
Ejemplo n.º 3
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>)
                );
        }
Ejemplo n.º 4
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());
        }
Ejemplo n.º 6
0
        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)
                );
        }
Ejemplo n.º 7
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>)
                );
        }
Ejemplo n.º 8
0
        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 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());
        }
        public void MethodInfoClosedInGenIfcNongenMethodRefTypeWithTarget()
        {
            KeepDataInterceptor interceptor = new KeepDataInterceptor();
            IGenInterfaceHierarchyBase <List <object> > target = new GenInterfaceHierarchy <List <object> >();
            IGenInterfaceHierarchyBase <List <object> > proxy  =
                generator.CreateInterfaceProxyWithTarget <IGenInterfaceHierarchyBase <List <object> > >(target, interceptor);

            proxy.Add(null);
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(void),
                                                       typeof(List <object>));
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethodInvocationTarget(), typeof(void),
                                                       typeof(List <object>));
            Assert.AreNotEqual(interceptor.Invocation.GetConcreteMethod(),
                               interceptor.Invocation.GetConcreteMethodInvocationTarget());

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