title: How to call async from [TestMethod]?
body: <p>I have a rather complicated method in a WebAPI MVC project. It does a number of things including hitting a remote server for user authentication. Depending on the results of this, it returns either a redirect (a page), a string error message, or an object representing all of the authentication monkey-business.</p>
  
  <p>It works great when called from a browser. It even works just fine in debug. I can even write a redirect to it and call it "manually", passing in whatever params it needs.</p>
  
  <p>The issue I'm running into is calling it from a test project VS made when I created the WebAPI project. I suspect that it's because because of all the <code>async</code> and <code>await</code> that gets thrown about. When it goes into it, eventually it comes back with a "Object not set to instance of an object" error. </p>
  
  <p>Since it works in any other context, I assume that it's because it's inside of a test project and needs to be awaited. Can anyone give me any kind of advice on this?</p>
  
  <p>Edit: to be very specific, it's failing on the second line of code here:</p>
  
  <pre><code>BoxConfig boxConfig = new BoxConfig(ClientID, ClientSecret, enterpriseID, prvt, JWTPublicKeyPass, JWTPublicKeyID);
  BoxJWTAuth boxJWT = new BoxJWTAuth(boxConfig); //This is a JSON web token and is needed to authorize the enterprise level app user.
  </code></pre>
  
  <p>Code context:</p>
  
  <p>This is leveraging the Box.com API. The BoxJWT call creates a JSON Web Token. I don't know where in the process it is failing because when I trace through it, it can't show me the code for things like PEMReader.cs, etc (which have to do with crypto, bouncy castle). But very specifically, the error message detail says the source is <code>Box.V2.JWTAuth.PEMPasswordFinder.GetPassword()</code></p>