Unit tests on private methods

Is it possible to run unit tests on private methods and functions in classes ?
If so, how do you do it ?

no. the XUT framework can’t call a private method like any other module/framework can’t call a private method.


Delegates sidestep scope, so you can do…

[code]Class Class1
Private Sub foo()
MsgBox “just me”
End Sub
End Class

Class MyUnitTest

Delegate Sub delAccessToFoo()

Sub testClass1()
dim c As new Class1
dim d As delAccessToFoo = AddressOf c.foo //foo is private but you can still grab it
End Sub

End Class[/code]

or compress those lines to…

delAccessToFoo(AddressOf c.foo).Invoke

Introspection should also be unaffected by scope.

Thanks for the replies, I’ll give the Delegate methods a try :slight_smile: