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
Post a Comment