title: How to write integration test for asp.net web api
body: <p>I am busy design a web service with asp.net web api. And I want to start doing unit tests on each controller.</p>
  
  <p>here is my test class so far:</p>
  
  <pre><code>[TestClass]
  public class MyDevicesControllerTest
  {
      [TestMethod]        
      public void TestValidUser()
      {
          MyDeviceController controller = new MyDeviceController();
          var result = controller.Get();
  
      }
  
      [TestMethod]
      public void TestInvalidUser()
      {
          MyDeviceController controller = new MyDeviceController();            
          var result = controller.Get();
      }
  }
  </code></pre>
  
  <p>But my web service makes use of token authentication. So I some how need to emulate the authentication process.</p>
  
  <p>So I was thinking my i not maybe make user of a Http Request to test it? Ie instead of testing the controller I just make a http Request and check its answer? </p>
  
  <p>What is the easier / better way to go about testing it?</p>