C# Unit Testing - Generating Mock DataContexts / LINQ -> SQL classes

Posted by gav on Stack Overflow See other posts from Stack Overflow or by gav
Published on 2010-04-26T12:21:14Z Indexed on 2010/04/26 12:23 UTC
Read the original article Hit count: 200

Filed under:
|
|
|

Hi All,

I am loving the new world that is C#, I've come to a point with my toy programs where I want to start writing some unit tests.

My code currently uses a database via a DatabaseDataContext object (*.dbml file), what's the best way to create a mock for this object? Given how easy it is to generate the database LINQ -> SQL code and how common a request this must be I'm hoping that VS2010 has built in functionality to help with testing.

If I'm way off and this must be done manually could you please enlighten me as to your preferred approach?

Many Thanks,

Gavin

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET