Exemple #1
0
        public void ResolveReferencedMethod_GenType_ValueType()
        {
            MethodInfo wrappedMethod = typeof(List <int>).GetMethod("Add");
            var        attribute     = new TestMethodReferencingAttribute(typeof(List <int>), "Add", wrappedMethod.ToString());

            var resolvedMethod = attribute.ResolveReferencedMethod();

            Assert.That(resolvedMethod, Is.EqualTo(wrappedMethod));
        }
Exemple #2
0
        public void ResolveReferencedMethod_GenMethod()
        {
            MethodInfo wrappedMethod = typeof(ClassWithConstrainedGenericMethod).GetMethod("GenericMethod");
            var        attribute     = new TestMethodReferencingAttribute(typeof(ClassWithConstrainedGenericMethod), "GenericMethod", wrappedMethod.ToString());

            var resolvedMethod = attribute.ResolveReferencedMethod();

            Assert.That(resolvedMethod, Is.EqualTo(wrappedMethod));
        }
Exemple #3
0
        public void ResolveReferencedMethod()
        {
            var wrappedMethod = typeof(DateTime).GetMethod("get_Now");
            var attribute     = new TestMethodReferencingAttribute(typeof(DateTime), "get_Now", wrappedMethod.ToString());

            var resolvedMethod = attribute.ResolveReferencedMethod();

            Assert.That(resolvedMethod, Is.EqualTo(wrappedMethod));
        }
Exemple #4
0
        public void ResolveReferencedMethod_GenMethod_GenType()
        {
            var        genericType   = typeof(GenericClassWithGenericMethod <IConvertible, List <string>, DateTime, object, IConvertible, List <List <IConvertible[]> > >);
            MethodInfo wrappedMethod = genericType.GetMethod("GenericMethod");
            var        attribute     = new TestMethodReferencingAttribute(genericType, "GenericMethod", wrappedMethod.ToString());

            var resolvedMethod = attribute.ResolveReferencedMethod();

            Assert.That(resolvedMethod, Is.EqualTo(wrappedMethod));
        }