Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit Testing ASP.Net MVC Action result with call to Server.UrlDecode

We are trying to write Unit Tests in our ASP.Net MVC project.

Some of the methods in the controller contain a call to Server.UrlDecode

This fails with a null reference exception when called from a unit test.

Anybody have a solution for this?

like image 997
Shiraz Bhaiji Avatar asked Jan 22 '10 15:01

Shiraz Bhaiji


1 Answers

Use the static HttpUtility class and its UrlDecode method.

HttpUtility.UrlDecode(mystring);
like image 120
aanund Avatar answered Nov 19 '22 14:11

aanund