Beispiel #1
0
        public void ApplyCacheProfile_DoesNotSetLocationOrDuration_IfNoStoreIsSet(
            CacheProfile cacheProfile,
            string output)
        {
            var context = new DefaultHttpContext();

            context.ApplyCacheProfile(cacheProfile);

            Assert.Equal(output, context.Response.Headers[HeaderNames.CacheControl]);
        }
Beispiel #2
0
        public void ApplyCacheProfile_CanSetCacheControlHeaders_CacheControlAndPragmaSetToOutput(
            CacheProfile cacheProfile,
            string output)
        {
            var context = new DefaultHttpContext();

            context.ApplyCacheProfile(cacheProfile);

            Assert.Equal(output, context.Response.Headers[HeaderNames.CacheControl]);
        }
Beispiel #3
0
        public void ApplyCacheProfile_SetsPragmaOnNoCache_CacheControlSetTonoStoreNoCachePragmaSetToNoCache()
        {
            var cacheProfile = new CacheProfile
            {
                Duration     = 0,
                Location     = ResponseCacheLocation.None,
                NoStore      = true,
                VaryByHeader = null
            };
            var context = new DefaultHttpContext();

            context.ApplyCacheProfile(cacheProfile);

            Assert.Equal("no-store,no-cache", context.Response.Headers[HeaderNames.CacheControl]);
            Assert.Equal("no-cache", context.Response.Headers[HeaderNames.Pragma]);
        }