Unit testing and templates

Unit testing and templates

Old forum URL: forums.lhotka.net/forums/t/3306.aspx


triplea posted on Wednesday, August 01, 2007

Having releases my first app using CSLA in production recently (hurray!) I decided that my unit tests were very basic (mainly because of time constraints - I know that's not an excuse but...). In any case I started planning how to write unit tests for my objects to test things that matter most to me. These I decided to be:

Now my question is twofold:

  1. The above work fine for BusinessBase objects (or EditableRoot if you like). But how do you go about writing a CRUD test for EditableChild objects? The main issue is FK constraints, the fact that an existing connection (and transaction) need to exist etc... By the way I don't want to use mocks and am happy to hit the database for these operations (even if running time is longer).
  2. Writing basic unit tests is boring :-). Has anonye got any templates (CodeSmith or other) for at least the basic of tests (such as for simple validation rules).

Copyright (c) Marimer LLC