Skip to content

ArgumentNullException testing doesn't need deep and complex object graphs #7

Description

@JSkimming

Testing for ArgumentNullException doesn't need test specimens with deep object graphs, or even to have auto properties populated. In fact doing so increased the chances of specimen creation failure, by having to create more objects often out of the control of the system under test.

All of the uses so far had to add the following customisation to the AutoFixture.

varthrowingRecursionBehavior=fixture.Behaviors.OfType<ThrowingRecursionBehavior>().SingleOrDefault();if(throwingRecursionBehavior!=null){fixture.Behaviors.Remove(throwingRecursionBehavior);fixture.Behaviors.Add(newOmitOnRecursionBehavior());}fixture.OmitAutoProperties=true;

It would be simpler to use AutoTest.ArgumentNullException if the framework did this automatically.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions