Autofixture test for invalid constructor parameter
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 ArgumentNullException . But since I use the Autofixture's CreateAnonymous method I get a TargetInvocationException instead. What is the correct way to write those kinds of tests? 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