I am currently testing my application and trying to figure out how to create my own fake URL. I tried hard-coded it, but I get an error that it is read-only. Here is what I have tried so far:
fakeController.HttpContext.Request.UrlReferrer.AbsolutePath = "http://www.yahoo.com";
as well as
fakeController.Request.UrlReferrer = "http://www.yahoo.com";
I searched the web for some ideas on how to create a fake / mock url for my fake controller, but no luck. Any suggestions are welcome.
Note. I am using Visual Studios built-in testing tools.
UPDATE:
Thank you all for your suggestions so far, I would be more than ready to use any other module testing system outside of Visual Studio, unfortunately, here, at my work, we are allowed to use only the built-in Visual Studio system, so I have to work with what I have. Thanks, though, it's good to know that these options are there.
source
share