This project is read-only.

Using .With() with delayed execution values?

Apr 4, 2012 at 1:06 AM

Is there any way to use/extend .With()  with delayed execution values.

I'd like to be able to do something like:

var item = fixture.Build<Item>().With(s=>s.Number, randomNumberGenerator.Generate()).CreateMany(500);

so that for each built item the func is called to populate a different number.

I could place the logic in a SpecimenBuilder but the above would be much more succinct.

Are there any other ways to tackle this?

Apr 4, 2012 at 6:46 AM
Edited Apr 4, 2012 at 6:46 AM

Here's one way to do it: http://autofixture.codeplex.com/discussions/262657

Here's another: http://stackoverflow.com/questions/5398258/customizing-autofixture-builder-with-seeded-property

HTH