views:

53

answers:

1

Does anyone know of a test data generator that will create the code to populate a .NET collection class which can then be copied into a unit test?

Searching this site, all the tools mentioned seem to hit databases and I already have Red Gate's SQL Data Generator for that task. However if one follows the TDD paradigm and/or model first development, the database may not exist yet.

What I would expect is a tool that can be pointed at a DLL (or better still integrated into Visual Studio); then it would reflect the writeable properties of that library; allow selection of a particular collection class; create an editable grid; and finally generate code to populate the selected collection class. This code could then be copied into the unit test.

If it could play well with Moq, that would be a bonus.

Thanks

Crispin

+1  A: 

You may take a look at AutoFixture.

Darin Dimitrov
Thanks for the link. AutoFixture looks interesting and I'll delve into it sometime. At the moment I'm looking for a finished tool.
CrispinH
FWIW, AutoFixture *does* play well with Moq: http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx
Mark Seemann
It's true that AutoFixture is not a tool, but it wouldn't be hard to write an app around it that does what you want.
Mark Seemann