I'm trying to write some extensions for testing and one of the specs I want to run would be based on finding the list of attributes associated with a method (action).
So far, this is the code I use to grab attributes off a method:
var homeController = new HomeController();
(controller.GetType().GetMethod(action, parameters)).GetCustomAttributes(false)
etc...
or for a controller, something like this (which is more explicit and not reusable)
(typeof(HomeController)).GetCustomAttributes(false)
So the question is, given I have a generic action of type ActionResult example:
var actionResult = new HomeController().Index();
Is there a way to find the attributes of that instance of the actionResult ?