Here a mock transaction is used to enclose three expected delete commands executed from stored procedures. As the test shares the connection object via the SetUp routine, there is no need to call the transaction object's Verify method. Instead, this is automatically called from the connection object's Verify method in the fixture's TearDown method.
Mock on
Test driven development has been around for a few years now and, while unit testing frameworks such as NUnit are increasingly popular, the use of mock objects still seems to largely be considered an esoteric art. While the learning curve is sharpened by the lack of good documentation for the existing .NET mock object frameworks, perseverance is usually well rewarded. For example, there is little worse than wasting time debugging failed unit tests only to find the problem lies with an external dependency that is causing your otherwise perfect class to misbehave!
Sample code on the CD
NMockExample.zip
DotNetMockExample.zip
Online Resources
http://www.nunit.org
http://www.nmock.org/
http://sourceforge.net/projects/dotnetmock/
easymocknet
CD Files
NUnit 2.2.0
NMock
DotNetMock 0.76
EasyMockNet 1.1
TestRunner for VS.NET ::