Esempio n. 1
0
        public void MethodInfoClosedInGenTypeGenMethodValueType()
        {
            KeepDataInterceptor          interceptor = new KeepDataInterceptor();
            GenClassWithGenMethods <int> proxy       = generator.CreateClassProxy <GenClassWithGenMethods <int> >(interceptor);

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

            proxy.DoSomething(new List <object>());
            GenericTestUtility.CheckMethodInfoIsClosed(interceptor.Invocation.GetConcreteMethod(), typeof(int),
                                                       typeof(List <object>));
        }
Esempio n. 2
0
        public void ProxyWithGenericArgumentsAndMethodGenericArguments()
        {
            GenClassWithGenMethods <List <object> > proxy =
                generator.CreateClassProxy <GenClassWithGenMethods <List <object> > >(logger);

            Assert.IsNotNull(proxy);

            proxy.DoSomething("z param");

            Assert.IsTrue(proxy.Invoked);
            Assert.AreEqual("z param", proxy.SavedParam);
            Assert.AreEqual("DoSomething ", logger.LogContents);
        }
Esempio n. 3
0
        public void ProxyWithGenericArgumentsAndMethodGenericArgumentsWithOneNotDefinedOnType()
        {
            GenClassWithGenMethods <List <object> > proxy =
                generator.CreateClassProxy <GenClassWithGenMethods <List <object> > >(logger);

            Assert.IsNotNull(proxy);

            int value1 = 10;

            proxy.DoSomethingElse <string>(delegate(int param1) { return(param1.ToString()); }, value1);

            Assert.IsTrue(proxy.Invoked);
            Assert.AreEqual("10", proxy.SavedParam);
            Assert.AreEqual("DoSomethingElse ", logger.LogContents);
        }