public void CanTakeUnqualifiedType()
 {
     var testType = typeof (Category);
     var typeAssemblyHolder = new TypeAssemblyHolder(testType.FullName);
     Assert.IsFalse(typeAssemblyHolder.IsAssemblyQualified);
     Assert.AreEqual(testType.FullName, typeAssemblyHolder.GetTypeName());
     Assert.AreEqual(null, typeAssemblyHolder.GetAssemblyName());
 }
示例#2
0
 public void CanTakeUnqualifiedGenericType()
 {
     var testType = typeof (TestGenericObject<int, string>);
     var tah = new TypeAssemblyHolder(testType.FullName);
     Assert.IsFalse(tah.IsAssemblyQualified);
     Assert.AreEqual(testType.FullName, tah.GetTypeName());
     Assert.AreEqual(null, tah.GetAssemblyName());
 }
示例#3
0
        private static Type LoadTypeDirectlyFromAssembly(TypeAssemblyHolder typeInfo)
        {
            Type type = null;

            var assembly = Assembly.Load(typeInfo.GetAssemblyName());

            if (assembly != null)
                type = assembly.GetType(typeInfo.GetTypeName(), true, true);

            return type;
        }
示例#4
0
 private static Type LoadTypeByIteratingOverAllLoadedAssemblies(TypeAssemblyHolder typeInfo)
 {
     Type type = null;
     var assemblies = AppDomain.CurrentDomain.GetAssemblies();
     foreach (var assembly in assemblies)
     {
         type = assembly.GetType(typeInfo.GetTypeName(), false, false);
         if (type != null)
             break;
     }
     return type;
 }
示例#5
0
        private static Type LoadTypeDirectlyFromAssembly(TypeAssemblyHolder typeInfo)
        {
            Type type = null;

            var assembly = Assembly.Load(typeInfo.GetAssemblyName());

            if (assembly != null)
            {
                type = assembly.GetType(typeInfo.GetTypeName(), true, true);
            }

            return(type);
        }
示例#6
0
        private static Type LoadTypeByIteratingOverAllLoadedAssemblies(TypeAssemblyHolder typeInfo)
        {
            Type type       = null;
            var  assemblies = AppDomain.CurrentDomain.GetAssemblies();

            foreach (var assembly in assemblies)
            {
                type = assembly.GetType(typeInfo.GetTypeName(), false, false);
                if (type != null)
                {
                    break;
                }
            }
            return(type);
        }