title: Moq and throwing a SqlException
body: <p>I have the following code to test that when a certain name is passed to my method, it throws a SQL exception (there is reason to that one, although it sounds a little odd).</p>
  
  <pre><code>   mockAccountDAL.Setup(m =&gt; m.CreateAccount(It.IsAny&lt;string&gt;(), 
  "Display Name 2", It.IsAny&lt;string&gt;())).Throws&lt;SqlException&gt;();
  </code></pre>
  
  <p>However, this won't compile because SqlException's constructor is internal:</p>
  
  <blockquote>
    <p>'System.Data.SqlClient.SqlException' must be a non-abstract type with
    a public parameterless constructor in order to use it as parameter
    'TException' in the generic type or method
    'Moq.Language.IThrows.Throws()'</p>
  </blockquote>
  
  <p>Now, I could change this to state that it should throw <code>Exception</code>, but that wouldn't work for me, because my method should return one status code if it is a <code>SqlException</code> and another if it is any other exception. That's what my unit test is testing. </p>
  
  <p>Is there any way to achieve this without either changing the logic of the method I'm testing, or not testing this scenario?</p>