I am trying to create a web api by System.Web.Http.
In a function I use HttpContext.Current.Request.UserHostAddress to get request ip address.
But when I tried to test the controller, I don't know how to fake the ip address to controller.
var controller = new ApplicationMobileStateApiController();
controller.Request = new HttpRequestMessage();
controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
controller.RequestContext = mockContext;
return controller.Authorization(body);
How can I fake ip address to do this unit test of APIController?