c# - How to unit test Request.Form[""]? -


below controller's method :-

   [httppost]    public actionresult search(searchviewmodel model)    {        string selection = request.form["options"];        if (selection == "str1")        {            -----------------------------        }            } 

and it's based on condition getting value request.form.but request.form provide property , can't set it's value on unit testing method.is there way set it's value ?

do not use request.form["options"] inside. can have option property inside searchviewmodel class , can use instead. scenario required use session in controller method can use modelbinder


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -