I'm working on a project that writes ADO.NET code for a database. Source code located here: GenTools. It reads the stored procedures and tables from a database and outputs C# code. I added unit testing to the project using NUnit, and hit a stumbling block on testing the generated code.
Right now, I'm following these steps to test the generated code:
- Generate code
- Compile the generated code into an assembly
- Load assembly
- Use reflection to test generated code
The problem with this approach is that the tests have to be ran in order. The next step will never succeed if the previous one fails, and none of the steps can be left out. An example is here.
I don't like this setup because once step #4 is reached, a failed test on the generated code will prevent the rest from running.
Is there way way to make sure the first 3 steps run sequentially, then have all tests in step #4 seperated out? I don't mind switching testing frameworks.