Advait
Advait

Reputation: 1

Any libraries to auto populate a CLR object

Anyone know of any libraries that can autopopulate a CLR object?

Ex:

I have a User object with first name and last name as members. I would want to auto populate the object with some random values so the user object can be used right away.

User user = new User ();

// Explicit member assignment
user.setFirstName ("John");
user.setLastName ("Doe");

// I need this

AutoPopulateLibrary.fill (user);

I'll pass the user object or the class name or whatever and the target object must be magically filled.

Can this be done, or Am i missing something here?

Upvotes: 0

Views: 215

Answers (2)

Ruben Bartelink
Ruben Bartelink

Reputation: 61795

None of @Oded's cited posts mention Constrained Nondeterminism as embodied by AutoFixture, which is a powerful force for simplifying tests, including the autogeneration of data.

Upvotes: 0

Related Questions