title: ASP.NET MVC, HttpContext.Current is null while mocking a request
body: <pre><code>public async Task &lt;ActionResult&gt;Select(DWorkingTimeSelection dto) { 
      var session = HttpUtils.GetSeesion&lt;User&gt;("USER"); 
  } 
  
  public static T GetSeesion&lt;T&gt;(string key) where T : class
  { 
      if (HttpContext.Current == null) 
      { 
          return default(T);
      }
       return HttpContext.Current.Session[key] as T; 
  }
  
  public async Task &lt;ActionResult&gt;Select(DWorkingTimeSelection dto) { 
      var session = HttpUtils.GetSeesion&lt;User&gt;("USER"); 
  } 
  
  public static T GetSeesion&lt;T&gt;(string key) where T : class
  { 
      if (HttpContext.Current == null) 
      { 
          return default(T);
      } 
      return HttpContext.Current.Session[key] as T; 
  }
  </code></pre>
  
  <p>I use nunti to mock a request.
  And I add the SessionStateItemCollection to  the Controller 's ControllerContext . 
  I found that the HttpContext.Current is null but the Controller 's  Session[]
  is not null because it get from the  Controller 's ControllerContext .
  So what should I do to avoid the HttpContext.Current is null while mocking a request</p>