title: Returning different HTTP status code for testing
body: <p>I am writing some integration tests for an MVC web application, which involves firing http post and get requests at an instance of the application that I spin up with IIS Express.</p>
  
  <p>The problem is that I want to assert that validation has passed (for example on account creation), and obviously this is impossible to interpret from just validation messages mixed in with markup that is returned (well not impossible, but out of the question).</p>
  
  <p>What I am currently doing is checking the <code>ModelState</code> in my controller base class in the <code>OnActionExecuted</code> event and setting the status code to a 202 (Accepted but still requires processing):</p>
  
  <pre><code>protected override void OnActionExecuted(ActionExecutedContext filterContext)
  {
       if (!ModelState.IsValid)
       {
            Response.StatusCode = 202;
       }
  
       base.OnActionExecuted(filterContext);
  }
  </code></pre>
  
  <p>I know 202 doesn't really reflect what has happened, but there isn't a status code that fits the situation, and it won't cause an error on the browser when the application is in normal use.</p>
  
  <p>What are peoples opinions of this design? And will it have any adverse affects?</p>