Here is a link to a mock object project for .net data providers

http://sourceforge.net/projects/dotnetmock/

The real key to this though, if you want to test your code that uses database
access is how to inject the test data.  With a separate test database, you have
only to change connection strings, but what you will most likely find is that
after a point, the amount of test data will be too much to reset before each
test to start with a clean database.  You may have problems with multiple users
and the test database if the developers can't install locally.

If your lower level data commands are instantiated with a factory, unlike most
code samples, unlike the MS data app block, but like Deyan Petrov's example at
codeproject and like SnapDAL at sourceforge, there exists the possiblity of
having your data layer inject test data, mock objects or alternate databases
when in test mode. I'm hoping to bounce my ideas off some higly qualified folks
at the end of this month before I dive in full steam to prove this, but I still
haven't come up with a more elegant solution to the problem of test data for
unit test.

Martin Fowler has talked and written about the problem and partial solutions as
well.  You might find some of it linked at martinfowler.com

--- "Eric V. Smith" <[EMAIL PROTECTED]> wrote:
> SteveC said:
> > My development cycle typically includes tiered coders, each are given an
> > explicit document of "what to do", even in calling stored procedures.
> > The problem is that all of the stored procedures are not ready or
> > written (or sometimes fully thought out and need to be changed) on the
> > DB side of things.  So it would be to the .NET component developer's
> > advantage to have the DB-calling code in place, but instead of calling
> > the real thing, it just calls this pseudo-MSSQL-host.  Then the .NET
> > coders could perform unit testing and etc without having things break
> > when they are actually supposed to get data from "somewhere".
>
> It sounds like you want to use a mock object pattern.
>
> A java example is
> http://javaboutique.internet.com/tutorials/mock_objects/, but the
> technique obviously applies elsewhere.
>
> Eric.
>
> ===================================
> This list is hosted by DevelopMentorŪ  http://www.develop.com
> Some .NET courses you may be interested in:
>
> NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
> http://www.develop.com/courses/gaspdotnetls
>
> View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to