title: Which object should I mock?
body: <p>I am writing a <a href="http://martinfowler.com/eaaCatalog/repository.html" rel="nofollow noreferrer">repository</a>. Fetching objects is done through a DAO. Creating and updating objects is done through a Request object, which is given to a RequestHandler object (a la <a href="http://en.wikipedia.org/wiki/Command_pattern" rel="nofollow noreferrer">Command pattern</a>). I didn't write the DAO, Request, or RequestHandler, so I can't modify them.</p>
  
  <p>I'm trying to write a test for this repository. I have mocked out both the DAO and RequestHandler. My goal is to have the mocked RequestHandler simply add the new or updated object to the mocked DAO. This will create the illusion that I'm talking to the DB. This way, I don't have to mock the repository for all the classes that call this repository.</p>
  
  <p>The problem is that the Request object is this gob of string blobs and various alphanumeric codes. I'm pretty sure XML is involved too. It's sort of a mess. Another developer is writing the code to create the Request object based on the objects being stored. And since RequestHandler takes in Requests and not the object I'm storing, it can't update the mocked DAO.</p>
  
  <p>So the question is: do I mock the Request too, or should I wait until the other guy, who is kind of slow, to finish his code before I write the test? Or screw it and mock out the entire repository when testing the classes that call the repository?</p>
  
  <p>BTW, I say "mock" not in the NMock sense, but rather like faking the DB with an in-memory collection.</p>