title: Using MVC3 and EF4, how can one adequately test functionality that relies on a round trip to the database to create IDENTITY values?
body: <p>I have a scenario where the code under test inserts a record into a database, then attempts to retrieve it back from the database using its primary key.</p>
  
  <p>This happens over a series of records in the same method.</p>
  
  <p>I am mocking my ObjectContext and ObjectSets, so the current result is that each record "inserted" into my FakeObjectSet is given a primary key of 0.</p>
  
  <p>In the case where I am only inserting a single record and asserting the record exists, this is fine...but when I am inserting multiple and my workflow requires retrieving specific records by primary key, my queries return multiple results since all inserts have a primary key of 0.</p>
  
  <p>Any ideas?</p>