title: Moq, how to moq objects with private constructor?
body: <p>I have this class hierarchy </p>
  
  <pre><code>public class Order
  {  
      private Client _client;
      public virtual Client { get =&gt; _client; }
  
      private OrderNumber _orderNumber;
      public virtual OrderNumber OrderNumber { get =&gt; _orderNumber; }
  
      private ShippingDetails _shippingDetails;
      public virtual ShippingDetails ShippingDetails { get =&gt; _shippingDetails; }
  
      private IList&lt;Product&gt; _products;
      protected internal virtual IEnumerable&lt;Product&gt; Products { get =&gt; _products; }
  
  
      public Order() { }
  
      public virtual void CreateDraftForClient(int id)
      {
           /// =&gt; business rule validation of value 
  
           _client= new Client(id);
  
            /// =&gt; event     
       }
  }
  
  public class Client
  {
      private int _id;
      public virtual int Id { get =&gt; _id; }
  
      private Client() { }
      protected internal Client(int id) 
      {
          SetId(id);
      }
  
      private void SetId(int id)
      {
          _id = id; 
      }
  }
  </code></pre>
  
  <p>And want to create a fully initialized mock of order</p>
  
  <pre><code> clientMock = new Mock&lt;Client&gt;();
   clientMock.SetupGet(prop =&gt; prop.Client).Returns(1);
  
   orderMock = new Mock&lt;Order&gt;();
   orderMock.SetupGet(prop =&gt; prop.Client).Returns(orderMock.Object);
  </code></pre>
  
  <p>Exception :</p>
  
  <pre><code>Message: System.AggregateException : One or more errors occurred. (Can not instantiate proxy of class: Client. Could not find a parameterless constructor.) (The following constructor parameters did not have matching fixture data: eRxTestSetup testSetup)
  ---- Castle.DynamicProxy.InvalidProxyConstructorArgumentsException : Can not instantiate proxy of class: Client. Could not find a parameterless constructor.
  ---- The following constructor parameters did not have matching fixture data: eRxTestSetup testSetup
  </code></pre>
  
  <p>Is there any way i can do so without having to change the structure of the Client? Or if not, what other options do I have ? </p>