You should first write unit tests for your DAL objects. Once done, you write unit tests for your business objects. Yes, the business objects will call DAL functions, but so what? You need to test the business objects as black boxes. You give it a known set of inputs and you expect a certain set of outputs.
If a business object fails a test, the actual problem might be in the DAL or DB, but the fact remains that the business object gave you a red light. Hopefully your DAL tests will tell you if the problem is at that layer. But regardless of where the bug is located, the user of the business object sees that he's not getting the expected result, so the unit test still has validity.
Unit tests can help you find bugs, but they don't take the place of traditional debugging techniques. If they did, many of us would be out of a job!
|