I\'m trying to implement what\'s seen here: http://www.piotrwalat.net/nhibernate-session-management-in-asp-net-web-api/ but I\'m having an issue with my NhSessionManag
For anyone else who comes across this, ActionFilterAttribute will not fire when calling YourController.YourAction from your UnitTest.
[TestMethod]
public void RevokeSiteAdmin_SessionOver()
{
FakeDbContext db = new FakeDbContext();
YourController controller = new YourController(db);
var result = controller.YourAction();
//Some Assertions
}
In the TestMethod above, any ActionFilterAttributes on YourController.YourAction will not be called. However; if you call YourController.YourAction from a browser, your ActionFilterAttribute will be called.
This is true for at least WebApi, but I don't know if it applies to MVC.