/// <summary>
 /// Initializes a new instance of the <see cref="FakeHttpCachePolicy"/> class.
 /// </summary>
 public FakeHttpCachePolicy()
 {
     this.cacheExtensions = new List<string>();
     this.validationCallbacks = new List<Tuple<HttpCacheValidateHandler, object>>();
     this.varyByContentEncodings = new HttpCacheVaryByContentEncodings();
     this.varyByHeaders = new HttpCacheVaryByHeaders();
     this.varyByParams = new HttpCacheVaryByParams();
 }
        public void OutputCacheSetsVaryByValues()
        {
            // Arrange
            var timestamp = new DateTime(2011, 1, 1, 0, 0, 0);
            var context = new Mock<HttpContextBase>();
            context.SetupGet(c => c.Timestamp).Returns(timestamp);
            var response = new Mock<HttpResponseBase>().Object;

            var varyByParams = new HttpCacheVaryByParams();
            var varyByHeader = new HttpCacheVaryByHeaders();
            var varyByContentEncoding = new HttpCacheVaryByContentEncodings();

            var cache = new Mock<HttpCachePolicyBase>();
            cache.SetupGet(c => c.VaryByParams).Returns(varyByParams);
            cache.SetupGet(c => c.VaryByHeaders).Returns(varyByHeader);
            cache.SetupGet(c => c.VaryByContentEncodings).Returns(varyByContentEncoding);

            // Act
            ResponseExtensions.OutputCache(context.Object, cache.Object, 20, false, new[] { "foo" }, new[] { "bar", "bar2" },
                                           new[] { "baz", "baz2" }, HttpCacheability.Public);

            // Assert
            Assert.Equal(varyByParams["foo"], true);
            Assert.Equal(varyByHeader["bar"], true);
            Assert.Equal(varyByHeader["bar2"], true);
            Assert.Equal(varyByContentEncoding["baz"], true);
            Assert.Equal(varyByContentEncoding["baz2"], true);
        }
 internal HttpCachePolicy() {
     _varyByContentEncodings = new HttpCacheVaryByContentEncodings();
     _varyByHeaders = new HttpCacheVaryByHeaders();
     _varyByParams = new HttpCacheVaryByParams();
     Reset();
 }