C# Visual Studio Unit Test, Mocking up a client IP address
Posted
by Jimmy
on Stack Overflow
See other posts from Stack Overflow
or by Jimmy
Published on 2010-04-20T21:32:41Z
Indexed on
2010/04/20
21:43 UTC
Read the original article
Hit count: 259
Hey guys,
I am writing some unit tests and I'm getting an exception thrown from my real code when trying to do the following:
string IPaddress = HttpContext.Current.Request.UserHostName.ToString();
Is there a way to mock up an IP address without rewriting my code to accept IP address as a parameter?
Thanks!
© Stack Overflow or respective owner