title: HttpContext Null through Unit testing
body: <p>I have following piece of code to evaluate the IP address</p>
  
  <pre><code> public string getIPAddress()
          {
              string IPAddress = string.Empty;
              String strHostName = HttpContext.Current.Request.UserHostAddress.ToString();
              IPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
              return IPAddress;
  
  
          }
  </code></pre>
  
  <p>Now when I tried to implement unit testing for this method, it always throws error, null reference,</p>
  
  <p>I could not change the actual method just for unit testing, is there any way to handle this...</p>
  
  <p>Thanks</p>