locked
Unit testing a business layer that uses a LINQ to SQL DataContext

    Question

  • We're looking at using LINQ to SQL to replace our DAL, as most of the DAL deals with CRUD-type operations, the code in there is fairly mundane.    I've been doing a fair bit of reading, to see how this could be done and there doesn't seem to be a whole lot of guidance out there, relating to this topic.   Scott Gu as some great tutorials to get folks started with it, but doesn't discuss how this fits in to a real n-tier app.

     

    We have a business layer that we use behind our WCF services, and this is essentially where we want to use LINQ to SQL.   We used the designer to reverse-engineer our database and have a new shiny OURDBDataContext to use.   When we construct our business layer, we'd like to use the depedency injection pattern to inject either the real datacontext to use, or a MockDataContext.   Is this doable?  Are there any examples of this? 

     

     

    Saturday, July 21, 2007 2:59 PM

Answers

All replies