Example #1
0
        public void alter_chain_is_idempotent()
        {
            var att   = new CacheAttribute();
            var chain = new BehaviorChain();
            var call  = ActionCall.For <CacheAttributeTester>(x => x.alter_chain());

            chain.AddToEnd(call);

            att.Alter(call);
            att.Alter(call);
            att.Alter(call);
            att.Alter(call);
            att.Alter(call);

            chain.OfType <OutputCachingNode>().Single()
            .VaryByPolicies().Single().ShouldEqual(typeof(VaryByResource));
        }
Example #2
0
        public void alter_chain_with_more_overridden_vary_by()
        {
            var att = new CacheAttribute();

            att.VaryBy = new Type[] { typeof(VaryByResource), typeof(VaryByThreadCulture) };

            var chain = new BehaviorChain();
            var call  = ActionCall.For <CacheAttributeTester>(x => x.alter_chain());

            chain.AddToEnd(call);

            att.Alter(call);

            chain.OfType <OutputCachingNode>().Single().VaryByPolicies()
            .ShouldHaveTheSameElementsAs(typeof(VaryByResource), typeof(VaryByThreadCulture));
        }