Testing Code-Generated Code with NUnit, Temporary Files, Voodoo, Rubber Bands and Reflection
Testing Code-Generated Code with NUnit, Temporary Files, Voodoo, Rubber Bands and Reflection
Submitted by webmaster@testdriven.com (Links) on Tue, 04/01/2005 - 15:45. NUnit | test driven developmentWe're into Unit Testing here and getting more so every day. We also do a lot of code generation as well, and struggled with how to test that the code generation works from end to end. [..] These [generated] objects should compile, have the correct attributes, be create-able at runtime, and serialize correctly.
Here's how we run CodeSmith in the NUnit tests to generate into temporary .g.cs files. The ".g.cs" extension is our own invention, allowing us to keep track of what's generated and what's written by hand.
Author: Scott Hanselman
Published: January 1, 2005
Here's how we run CodeSmith in the NUnit tests to generate into temporary .g.cs files. The ".g.cs" extension is our own invention, allowing us to keep track of what's generated and what's written by hand.
Author: Scott Hanselman
Published: January 1, 2005
