Your question is asking a few things but I think item #1 is the answer you’re looking for.
-
Is it fine to use
Context.Itemsfor caching on a per request basis?
Yes. If in process, per request, per machine in the web farm is your criteria then Context.Items gives you that. -
Is
Context.Itemsdifficult to test with?
As far as testability, I would hideContext.Itemsbehind an interface of some sort. This way you get unit testing capabilities without having to referenceContext.Itemsdirectly. Otherwise, what do you need to test aboutContext.Items? That the framework will store and retrieve values? Keep your code ignorant ofSystem.Weband you’ll be a happy camper. -
Will
Context.ItemssurviveRedirectToAction?
No. Your test is invalid. It’s setting “Hello, world” on every web request and your test spans two web requests. The first is when the Index action is called. The second is whenRedirectToActionaction is called (it’s an HTTP 302). To make it fail, set a new value in the Index action and see if it’s retained in the About action.