Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }