what iWhat I normally do in c#C# is make my methods protected and not private. itsIt's a slightly less private access modifier, but it hides the method from all classes that do not inherit from the class under test.
public class classUnderTest
{
//this would normally be private
protected void methodToTest()
{
//some code here
}
}
now anyAny class that doesn't inherit directly from classUnderTest has no idea that methodToTest even exists. but, what it allows me to do inIn my test code is, I can create a special testing class that extends and provides access to this method...
class TestingClass : classUnderTest
{
public void methodToTest()
{
//this returns the method i would like to test
return base.methodToTest();
}
}
thisThis class only exists in my testing project. itsIts sole purpose is to provide access to this single method. itsIt allows me to access inside places that most other classes do not have.