asp.net mvc 4 - Using UrlHelper inside a controller breaks test -
i'm new mvc , tdd please go easy on me!
i have action needs redirect action. i'm constructing base uri follows:
urlhelper u = new urlhelper(this.controllercontext.requestcontext); string baseuri = u.action("paypalauth", "order");
i've adapted paypal's sample code (string baseuri = request.url.scheme + "://" + request.url.authority + "/order/paypalauth?";) maybe i've not used best method come baseuri target action?
main problem is, when call action mstest unit test null exception on controllercontext.
what's easiest way solve problem? have found similar questions on can't follow them. guess may need use mocking framework don't know start!
what's easiest way solve problem?
by mocking controllercontext
. here's example of how achieved: https://stackoverflow.com/a/32672/29407
Comments
Post a Comment