Unit testing the CodeSmith CSLA Templates

During the development of our CodeSmith CSLA templates we have spent a lot time unit testing the generated code to ensure everything was working correctly.

In the future we would like to generate basic CRUD unit tests for any project. We decided to unit test the PetShop database to go along with our PetShop Sample application. We have a solution both in VB and C# that can be found in (Documents\CodeSmith\Samples\v5.2\Projects\Framework-Samples\Csla) when you install CodeSmith or grab the latest version from SVN. We have unit tests for all the Data Access implementations as well as collections. We test primarily against two tables, Category and LineItem.

These NUnit tests will give you a good understanding of how different operations are performed in CSLA. Feel free to submit to CodeSmith support or forums any unit tests you think we don't have.  If you find a bug in the CSLA templates, its a huge help to the community and us if you submit a failing unit test for the PetShop sample application that can reproduce your bug. This ensures we have more testability and no regressions in future versions. However, any unit test will be appreciated along with the respected sample schema.

When contributing new unit tests, please try to follow our common testing pattern for consistency that outputs a description and how long it took to run the test.

Posted Apr 08 2010, 10:09 AM by Blake Niemyjski |
Filed under: ,
Copyright © 2008 Windows Coding
Microsoft and Microsoft logo's are trademarks of Microsoft Corporation.