I have a static method that uses reflection to find a class using reflection based on its name (qualified with namespace). The name is sent as a parameter to the method.
In essence, it looks like this (simplified):
public static Type GetClass(string qualifiedName)
{
return Type.GetType(qualifiedName);
}
Now, to test this in an MSTest unit test, I want to let it look for a test class that doesn't exist in the tested assembly, but is declared in the unit test assembly. But when I pass the qualified name of my test class to GetClass
, the call to Type.GetType
returns null
.
I assume the tested assembly's reflection system is unable to see stuff in the unit test assembly.
What do I need to do to ge this to work?
Aucun commentaire:
Enregistrer un commentaire