Ejemplo n.º 1
0
 [TestCase(typeof(long), typeof(int), false)] //
 public void IsAssignableFrom(Type target, Type argument, bool expected)
 {
     Assert.AreEqual(expected, TypeExtensions.IsAssignableFrom(target, argument));
 }
Ejemplo n.º 2
0
 public void GetMethod_Ambiguous(Type type, string name)
 {
     Assert.Throws <AmbiguousMatchException>(() => TypeExtensions.GetMethod(type, name));
 }
Ejemplo n.º 3
0
 public void IsValueType(Type type, bool expected)
 {
     Assert.AreEqual(expected, TypeExtensions.IsValueType(type));
 }
Ejemplo n.º 4
0
        public void GetMethod_NoSuchMethod(Type type, string name)
        {
            var method = TypeExtensions.GetMethod(type, name);

            Assert.IsNull(method);
        }
Ejemplo n.º 5
0
        public void GetProperty_NoSuchProperty(Type type, string name)
        {
            var property = TypeExtensions.GetProperty(type, name);

            Assert.IsNull(property);
        }
Ejemplo n.º 6
0
 internal static bool IsValueType(this Type target)
 {
     return(TypeExtensions.smethod_1(TypeExtensions.smethod_0(target)));
 }
Ejemplo n.º 7
0
        internal static PropertyInfo GetProperty(this Type target, string name)
        {
            while (true)
            {
IL_173:
                uint arg_127_0 = (target != null) ? 3462574241u : 2188921634u;
                while (true)
                {
                    uint num;
                    switch ((num = (arg_127_0 ^ 3380171852u)) % 12u)
                    {
                    case 0u:
                    {
                        PropertyInfo propertyInfo;
                        arg_127_0 = ((!TypeExtensions.smethod_7(propertyInfo)) ? 3618814751u : 2973301651u);
                        continue;
                    }

                    case 1u:
                    {
                        TypeInfo typeInfo = TypeExtensions.smethod_0(target);
                        arg_127_0 = 3231725208u;
                        continue;
                    }

                    case 2u:
                        arg_127_0 = 3462574241u;
                        continue;

                    case 3u:
                    {
                        TypeInfo typeInfo;
                        target    = TypeExtensions.smethod_9(typeInfo);
                        arg_127_0 = 2243421325u;
                        continue;
                    }

                    case 4u:
                    {
                        PropertyInfo propertyInfo;
                        return(propertyInfo);
                    }

                    case 5u:
                    {
                        PropertyInfo propertyInfo;
                        arg_127_0 = (((propertyInfo != null) ? 3875040517u : 4036738732u) ^ num * 4172870815u);
                        continue;
                    }

                    case 6u:
                    {
                        PropertyInfo propertyInfo;
                        arg_127_0 = (((!TypeExtensions.smethod_4(propertyInfo)) ? 2465284096u : 3240594463u) ^ num * 3716117260u);
                        continue;
                    }

                    case 7u:
                    {
                        PropertyInfo propertyInfo;
                        arg_127_0 = ((TypeExtensions.smethod_6(TypeExtensions.smethod_8(propertyInfo)) ? 1083058896u : 547771499u) ^ num * 1931570956u);
                        continue;
                    }

                    case 8u:
                    {
                        TypeInfo     typeInfo;
                        PropertyInfo propertyInfo = TypeExtensions.smethod_3(typeInfo, name);
                        arg_127_0 = (num * 1158742807u ^ 2567007021u);
                        continue;
                    }

                    case 9u:
                        goto IL_173;

                    case 11u:
                    {
                        PropertyInfo propertyInfo;
                        arg_127_0 = ((TypeExtensions.smethod_6(TypeExtensions.smethod_5(propertyInfo)) ? 3951386411u : 3282301751u) ^ num * 2213342445u);
                        continue;
                    }
                    }
                    goto Block_6;
                }
            }
Block_6:
            return(null);
        }
Ejemplo n.º 8
0
 internal static bool IsAssignableFrom(this Type target, Type c)
 {
     return(TypeExtensions.smethod_2(TypeExtensions.smethod_0(target), TypeExtensions.smethod_0(c)));
 }