title: Moq cannot create mock object of class with nullable parameter in the constructor
body: <p>I have this class:</p>
  
  <pre><code>public class TestClass
  {
   public TestClass(int? foo, string bar)
   {
     //..Something
   }
  }
  </code></pre>
  
  <p>I am trying to mock it using MOQ like this</p>
  
  <pre><code>var mockA = new Mock&lt;A&gt;(new object[] {(int?)1, string.Empty})
  </code></pre>
  
  <p>or this,   </p>
  
  <pre><code>var mockA = new Mock&lt;A&gt;(new object[] {1 as int?, string.Empty})
  </code></pre>
  
  <p>even this</p>
  
  <pre><code>var mockA = new Mock&lt;A&gt;(new object[] {(int?)null, string.Empty})
  </code></pre>
  
  <p>When I try to get the object like this</p>
  
  <pre><code>var objA = mockA.Object
  </code></pre>
  
  <p>it throws this exception</p>
  
  <p>Can not instantiate proxy of class: TestClass.
  Could not find a constructor that would match given arguments:
  System.Int32,
  System.String</p>
  
  <p>(for the third one it throws null reference exception)  </p>
  
  <p>How to make it recognize that first argument is of type Nullable System.Int32 and not System.Int32.  </p>
  
  <p>(Please ignore that I am mocking a class and not an interface.)</p>