The Without() method does not work when the class has 1 constructor with all parameters #1368
Unanswered
codequality44
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Without delving in the code. AF finds that the class you want to generate has a constructor. It resolves a value for each parameter of the constructor and uses them to construct an instance. It doesn't have a knowledge of the connection between the constructor parameter and the property you marked to be excluded with You have few options:
You can probably have an even stronger control by creating your own specimen builder, but I'd avoid it as much as possible :) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have the following class:
I want to create a mock with AutoFixture without filling HomeTown and SomeCollection.
But when I try to create it like this, the properties still get filled!
Fixture fixture = new Fixture();
`
Why is this behaviour?
Beta Was this translation helpful? Give feedback.
All reactions