コード例 #1
0
        public void WrappedInterfaceHasWrappedGenericMethods2()
        {
            var source  = typeof(IGenericInterface);
            var wrapped = GenericInterfaceWrapper.Wrap(source);

            var mi      = source.GetMethod("DoSomething");
            var newName = GenericInterfaceWrapper.GetWrappedName(mi);

            mi = wrapped.GetMethod(newName);
            Assert.IsNotNull(mi);

            var parameters = mi.GetParameters();

            Assert.AreEqual(6, parameters.Length);
            Assert.AreEqual(typeof(void), mi.ReturnType);

            // generic parameters
            Assert.AreEqual(typeof(Type), parameters[0].ParameterType);
            Assert.AreEqual(typeof(Type), parameters[1].ParameterType);
            Assert.AreEqual(typeof(Type), parameters[2].ParameterType);

            // method arguments
            Assert.AreEqual(typeof(object), parameters[3].ParameterType);
            Assert.AreEqual(typeof(object), parameters[4].ParameterType);
            Assert.AreEqual(typeof(object), parameters[5].ParameterType);
        }
コード例 #2
0
        public void WrappedMethodNameTest2()
        {
            var mi = typeof(IGenericInterface).GetMethod("DoSomething");

            Assert.IsNotNull(mi);

            var newName = GenericInterfaceWrapper.GetWrappedName(mi);

            Assert.AreEqual("DoSomething<A, B, C>", newName);
        }
コード例 #3
0
        public void WrappedMethodNameTest1()
        {
            var mi = typeof(IGenericInterface).GetMethod("GetVersion");

            Assert.IsNotNull(mi);

            var newName = GenericInterfaceWrapper.GetWrappedName(mi);

            Assert.AreEqual("GetVersion", newName);             // same as above
        }