public void Construct(IResourceResult resourceResult)
        {
            var expectedDuration = 8;
            var expectedSetting = CacheSetting.NoStore;

            var sut = new CacheControlDecorator(expectedDuration, expectedSetting, resourceResult);

            Assert.Equal(expectedDuration, sut.CacheDuration);
            Assert.Equal(expectedSetting, sut.CacheSetting);
        }
        public void Execute(IResourceResult resourceResult, IResourceResultContext context)
        {
            var expectedDuration = 8;
            var expectedSetting = CacheSetting.NoStore;
            var sut = new CacheControlDecorator(expectedDuration, expectedSetting, resourceResult);

            sut.Execute(context);
#if !DEBUG
            var regex = string.Format(@"{0}.+{1}", expectedSetting.ToDescription(), expectedDuration);
            context.FrameworkProvider.Verify(fp => fp.SetHttpResponseHeader("Cache-Control", It.IsRegex(regex)));
#else
            context.FrameworkProvider.Verify(fp => fp.SetHttpResponseHeader("Cache-Control", "no-cache"));
#endif
        }
        public void ExecuteWrappedResource([Frozen] IResourceResult resourceResult, CacheControlDecorator sut, IResourceResultContext context)
        {
            sut.Execute(context);

            resourceResult.Verify(rr => rr.Execute(It.IsAny<IResourceResultContext>()));
        }
        public void ConstructWithDefaults(IResourceResult resourceResult)
        {
            var sut = new CacheControlDecorator(resourceResult);

            Assert.False(sut.CacheSetting.HasValue);
        }