title: Creating Proxy/Mock Object From/Of Generic Type
body: <p>I would like to implement the following method:</p>
  
  <pre><code>public static T CreateProxyObject&lt;T&gt;(Dictionary&lt;String,Object&gt; setup) 
  </code></pre>
  
  <p>With the following Rules:</p>
  
  <p>1) I want to stay as generic as possible means T is not known during compile time and I want to be able to return it to user as the mocked/proxy requested type (user can still use normal intellisense to get object's metadata).</p>
  
  <p>2) It should have all its properties set/setup based on the setup Dictionary:</p>
  
  <pre><code>String-&gt; property name of the object
  
  Object-&gt; the return value for this property
  </code></pre>
  
  <p>Any other method should be implemented with throwing not implemented exception</p>
  
  <p>I was trying to use mock of T (from Moq framework) but T must be reference type.</p>
  
  <p>Had no success as well with Castle DynamicProxy and RealProxy. </p>
  
  <p>Any Idea? </p>