Ejemplo n.º 1
0
        public void MethodInfoClosedInGenIfcGenMethodRefTypeWithTarget()
        {
            var interceptor = new KeepDataInterceptor();
            GenInterfaceWithGenMethods <List <object> > target =
                new GenInterfaceWithGenMethodsImpl <List <object> >();
            var proxy = generator.CreateInterfaceProxyWithTarget(target, interceptor);

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

            proxy.DoSomething(new List <object>(), new List <object>());
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethod(),
                typeof(void),
                typeof(List <object>),
                typeof(List <object>)
                );
            GenericTestUtility.CheckMethodInfoIsClosed(
                interceptor.Invocation.GetConcreteMethodInvocationTarget(),
                typeof(void),
                typeof(List <object>),
                typeof(List <object>)
                );
            Assert.AreNotEqual(
                interceptor.Invocation.GetConcreteMethod(),
                interceptor.Invocation.GetConcreteMethodInvocationTarget()
                );
        }
		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());
		}