title: Mocking WCF RIA services in Silverlight - specification of submit operation response
body: <p>I am trying to mock WCF RIA services on the Silverlight side following <a href="http://www.silverlightshow.net/items/WCF-RIA-Services-Part-8-Testing-and-Debugging.aspx" rel="nofollow">WCF RIA Services Part 8 - Testing and Debugging</a> post.<br>
  I am injecting <code>DomainClient</code> into <code>DomainContext</code> and implementing its abstract methods in the mock.<br>
  However implementing the protocol is more or less a guess work since I was not able to find any guidance / specification.<br>
  <em>(I actually wrapped the default <code>DomainClient</code> and used the debugger to learn the communication details).</em></p>
  
  <ul>
  <li><p>For Queries I learned how to use Entities and IncludedEntities properties on the <code>QueryCompletedResult</code> class and that I need to "associate" them via foreign keys.  </p></li>
  <li><p>Submit is more tricky. I am not sure how to craft the proper <code>SubmitCompletedResult</code> as a response to the <code>ChangeSet</code>. I would like to mock correct behavior as well as some error scenarios.</p></li>
  </ul>
  
  <p><strong>Questions</strong>:</p>
  
  <ol>
  <li>Is there and documentation about the protocol? Commented code sample for Submit operation implementation would be great.</li>
  <li>Is somebody successfully using the same pattern for unit testing Silverlight applications? What is your experience?</li>
  <li>Is there any other approach how to mock WCF RIA services in Silverlight?</li>
  </ol>
  
  <p>Thanks in advance.</p>