Help create a unit test for test response header, specifically Cache-Control, in determining if cach

Posted by VajNyiaj on Stack Overflow See other posts from Stack Overflow or by VajNyiaj
Published on 2010-02-17T16:18:14Z Indexed on 2010/03/28 16:13 UTC
Read the original article Hit count: 399

Scenario:

I have a base controller which disables caching within the OnActionExecuting override.

protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
    filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
    filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false);
    filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
    filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache); //IE
    filterContext.HttpContext.Response.Cache.SetNoStore(); //FireFox 
}

How can I create a Unit Test to test this behavior?

© Stack Overflow or respective owner

Related posts about caching

Related posts about unit-testing