lundi 25 juillet 2016

How can I use AutoFixture to create an object but not fill out any properties

Using AutoFixture I can easily create an instance of a data object using the Create method like so:

_fixture.Create<FilterItems>()

Using this technique I am protected for any changes in the constructor that may come in the future, but it also fills out all properties which in this case (because it's a collection of filters) is not desired.

Is there any way to just tell AutoFixture to create the object, but not fill out any properties?

I know there's a Without method to skip a field, but using that means I have to keep adding to it whereas I'd rather just start with an empty object and add to it if a test needs it.

Aucun commentaire:

Enregistrer un commentaire