Don’t have the source for a .Net assembly. No problem. VS 2008 does the job of setting up unit test stubs for you.
Here’s how
- Create a new Test Project
- Right mouse click the project
- Click Add
- Click Unit Test
- Click Add Assembly
- Navigate to an already compiled assembly
VS 2008 reflects over the assembly and creates tests including
- Naming the test
- Reflecting over the parameters of the method calls and setting up default values
- Instantiating the class
- Calling the method and saves the actual result
- Defaulting the expected result
- Asserting the expected to the actual
- Asserting an Inconclusive test
Huge keystroke and time saver.
{ 0 comments… add one now }