Testing private members with a SelfTest() method
<p>I have a bunch of classes that wrap DB queries. I want to be able to test-run each query, and verify the result, returned to private members of my class. The perhaps barbaric idea that sprung to mind was to give my query wrappers a <code>public SelfTest()</code> method, visible to XUnit with a <code>[Fact]</code> attribute. As such, my test method would have access to the internals of the class and could verify in detail the outcome of the DB request.</p>

<p>Are there unhappy consequences I should be aware of? I would be adding a public method to my DB wrapper classes, but the method would do no damage. I would be making my application directly 'consumable' by XUnit, rather than having my tests in a separate project as I'm used to, but this seems harmless, no?</p>