title: How to write unit test for ActionFilter when using Service Locator
body: <p>I am planning to write an <code>ActionFilter</code> for business validation and in which some services will be resolved via Service Locator(I know this is not good practice and as far as possible i avoid Service Locator pattern, but for this case i want to use it). </p>
  
  <p><code>OnActionExecuting</code> method of the filter is something like this:</p>
  
  <pre><code>    public override void OnActionExecuting(ActionExecutingContext actionContext)
      {
          // get validator for input;
          var validator = actionContext.HttpContext.RequestServices.GetService&lt;IValidator&lt;TypeOfInput&gt;&gt;();// i will ask another question for this line
          if(!validator.IsValid(input))
          {
              //send errors
          }
      }
  </code></pre>
  
  <p>Is it possible to write unit test for above <code>ActionFilter</code>and how?</p>