Exemplo n.º 1
0
        public void Should_clear_all_cache_strategies_for_policy()
        {
            var policyContainer = new PolicyContainer("Controller", "Action", TestDataFactory.CreateValidPolicyAppender());

            policyContainer.Cache <RequireRolePolicy>(Cache.PerHttpRequest);
            policyContainer.Cache <RequireAllRolesPolicy>(Cache.PerHttpRequest);

            // Act
            policyContainer.ClearCacheStrategyFor <RequireRolePolicy>();

            // Assert
            Assert.That(policyContainer.CacheStrategies.Single().PolicyType, Is.EqualTo(typeof(RequireAllRolesPolicy)));
        }
Exemplo n.º 2
0
        public void Should_clear_all_cache_strategies_for_policy()
        {
            var policyContainer = new PolicyContainer("Controller", "Action", TestDataFactory.CreateValidPolicyAppender());
            policyContainer.Cache<RequireAnyRolePolicy>(Cache.PerHttpRequest);
            policyContainer.Cache<RequireAllRolesPolicy>(Cache.PerHttpRequest);

            // Act
            policyContainer.ClearCacheStrategyFor<RequireAnyRolePolicy>();

            // Assert
            Assert.That(policyContainer.CacheStrategies.Single().PolicyType, Is.EqualTo(typeof(RequireAllRolesPolicy)));
        }