pencilCake
pencilCake

Reputation: 53243

Way to generate a code that creates a constructor based on the current values of an object?

What I want to achieve is after loading my object from the database, to generate a code that will give me a block which initializes my object based on its current values so that I can use this code-block in my unit tests again and again without loading it from Db anymore.

Is there any tool around to achieve such a goal for VS?

thanks

Upvotes: 2

Views: 70

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038820

You could serialize the instance of the object into either XML or binary file and use this file in your unit test to deserialize it back to the instance.

Upvotes: 2

Related Questions