title: How do I UnitTest a custom ActionFilter?
body: <p>I've been trying to find some straightforward information on this, but I haven't been able to - either what I've found has been to vague for me to understand what's going on, or too specific for the wrong thing, for example a tutorial I found for unit testing an AuthorizeAttribute. (A third alternative is of course that I'm too dumb to realize that I'm reading the information I'm looking for... in which case I still need help, because I'm dumb :P)</p>
  
  <p>I'd like to be able to test two things:</p>
  
  <ol>
  <li>That a given ActionFilter is applied to an action (to make sure that the action meets requirements)</li>
  <li>That a given ActionFilter does what it's supposed to do.</li>
  </ol>
  
  <p>And I'm clueless. Could anyone push me in the right direction as to what I actually need to test? What should my Arrange, Act and Assert sections of the tests contain?</p>
  
  <hr>
  
  <p>A little detail, if I'm not clear enough:</p>
  
  <p>I have a <code>CustomValidationFilter</code> that is supposed to check if two submitted form values are the same, and add a <code>ModelStateError</code> if not. I want to verify that the error is added with the correct error message if the values are not the same, and that the error is <em>not</em> added if the values <em>are</em> equal (and non-null).</p>
  
  <p>I also have a <code>Write</code> action on a <code>GuestbookController</code>. I want to verify that the filter is applied to this action.</p>