How can I use Moles to check a DataContext's changes

274 views Asked by At

I am trying to use Moles to unit test a Linq To Sql datacontext. The method under test inserts several objects into the datacontext. My unit test should verify that those objects are actually going to be submitted to the database.

I had hoped that I could mole the SubmitChanges method and use the datacontext's GetChangeSet() method to retrieve the changes. Of course, I get an exception because the GetChangeSet() method is not moled. So what do I here? Am I missing a setup step?

Edit: This question seems to indicate that I can mole the SubmitChanges method to get the ChangeSet, but that method (appears) to be unusable because there's no mole for it. This makes me more strongly suspect that there's some kind of setup step that I am missing.

0

There are 0 answers