Enterprise Library 3.0 will include a new block
Tom and Ed have complimentary articles on the Policy Injection Application Block:
This block is really impressive. You can do things like: "Every time I call a method on class foo, call this method before hand, invisibly". Very useful if you ever had to add auditing after the fact on a data access layer, or a requirement for perf counters came up at the last minute. (Not that I have ever had to deal with either of those....)
How could you use this for testing? Create a test interception handler, and :
- mock out (either for acceptance or unit tests) the data acces layer.
- Introduce faults anywhere in the program you want to (I want to throw an OutOfMemoryException .... there, OR no, that file no longer exists. bye bye.)
Another name for this block is the Give-me-enough-rope-to-hang-myself-and-everyone-else-working-on-this-project-Block. It is very powerful, but if you write your own handlers, you must be careful. "With great power, comes great responsibility."
Check it out in the Enterprise Library CTP and enjoy.