Unit Testing, IDataContext and Stored Procedures via Linq

Posted by Terry_Brown on Stack Overflow See other posts from Stack Overflow or by Terry_Brown
Published on 2010-05-16T09:04:44Z Indexed on 2010/05/16 9:10 UTC
Read the original article Hit count: 377

hey folks,

I'm currently using Stephen Walther's approach to unit testing Linq to SQL and the datacontext (http://stephenwalther.com/blog/archive/2008/08/17/asp-net-mvc-tip-33-unit-test-linq-to-sql.aspx) which is working a treat for all things linq.

My Dal layer takes in an IDataContext, I use DI (via Unity) to concrete that up as the correct DataContext object and all works well.

But - we have a company policy here of writes going via Stored Procs.

Has anyone come up with a solution for mocking/faking the data context and still allowing stored procs to effectively be unit tested?

I've got no real experience of any of the mocking frameworks (Rhino etc.) so if these are the correct means of doing this, I'd love some pointers on guides for them.

Many thanks, Terry

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about unit-testing