title: Autofixture test for invalid constructor parameter
body: <p>I have the following class and test. I want to test passing a null value as a parameter to the constructor and are expecting an <code>ArgumentNullException</code>. But since I use the Autofixture's <code>CreateAnonymous</code> method I get a <code>TargetInvocationException</code> instead. </p>
  
  <p>What is the correct way to write those kinds of tests?</p>
  
  <pre><code>public sealed class CreateObject : Command {
      // Properties
      public ObjectId[] Ids { get; private set; }
      public ObjectTypeId ObjectType { get; private set; }
      public UserId CreatedBy { get; private set; }
  
      // Constructor
      public CreateObject(ObjectId[] ids, ObjectTypeId objectType, UserId createdBy) {
        Guard.NotNull(ids, "ids");
        Guard.NotNull(objectType, "objectType");
        Guard.NotNull(createdBy, "createdBy");
  
        Ids = ids;
        ObjectType = objectType;
        CreatedBy = createdBy;
      }
  }
  
  [TestMethod]
  [ExpectedException(typeof(ArgumentNullException))]
  public void constructor_with_null_ids_throw() {
      fixture.Register&lt;ObjectId[]&gt;(() =&gt; null);
      fixture.CreateAnonymous&lt;CreateObject&gt;();
  }
  </code></pre>