I'm trying to write a unit test for an abstract class. More specifically, I have a class like
public abstract class MyAbstractClass
{
// ...
private Something _myPrivateVariable;
// ...
protected void MyProtectedMethod(string[] names) { // ... }
// ...
}
and I want to call MyProtectedVoid
with parameters and then verify that _myPrivateVariable
was set to a particular value.
I know how to invoke a private
method of an instance of a class using GetMethod
like in How do I use reflection to invoke a private method?, but I don't know how to do this type of thing with an abstract
class considering that I can't create an instance of it.
Aucun commentaire:
Enregistrer un commentaire