title: Testing controller Action that uses User.Identity.Name
body: <p>I have an action that relies on User.Identity.Name to get the username of the current user to get a list of his orders:</p>
  
  <pre><code>public ActionResult XLineas()
      {
          ViewData["Filtre"] = _options.Filtre;
          ViewData["NomesPendents"] = _options.NomesPendents;
          return View(_repository.ObteLiniesPedido(User.Identity.Name,_options.Filtre,_options.NomesPendents));
      }
  </code></pre>
  
  <p>Now I'm trying to write unit tests for this, but I get stuck on how to provide a Mock for User.Identity.Name. If I run my test as I have it (without mock for User...), I get a Null.. exception.</p>
  
  <p>Which is the correct approach for this? I'm thinking that my Action code is not good for unit testing.</p>