How do I unit test my asp.net-mvc controller's OnActionExecuting method?

前端 未结 3 1142
不思量自难忘°
不思量自难忘° 2021-02-08 10:49

I\'ve overridden my controller\'s OnActionExecuting method to set some internal state based on the executing filterContext. How do I test this? The method itself is protected so

3条回答
  •  灰色年华
    2021-02-08 11:19

    I recently had a similar problem and could not find satisfying solution. So I created my own helper function that invokes OnActionExecuted and OnActionExecuting. See code here http://mkramar.blogspot.com.au/2012/06/onactionexecuting-and-onactionexecuted.html

提交回复
热议问题