tags:

views:

316

answers:

2

We are Facing an issue of passing the formcollection while unittesting. Is there a way to simulate these formcollection directly without having to set individual parameters. It becomes very tedious process of initilizing each and every object value for huge forms. I suppose there can be a direct way of dng it. Does anyone have idea about it ? Thaks in Advance.

+2  A: 

Rather than rewrite the code to fill the FormCollection for every unit test, create a method in your test class that generates a valid FormCollection that you can use for each test. You can add/remove/modify parameters from this "base" FormCollection to suit the needs of each unit test. This way you only have to write most of the code once for filling the FormCollection.

tvanfosson
A: 

I would Like to know whether its possible to serialize the form collection and use it later on . I tried serializing the objects, but when it came to serializing the formcollection its not supporting. Has anyone tried that

viren