views:

38

answers:

1

Hi,

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

+2  A: 

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.

Darin Dimitrov
any code-snippet as an example you have?
burak ozdogan