Permalink
Browse files

- Renamed PolicyResultCacheManifest to PolicyResultCacheManifest.

- Changed all occurances of "manifest" to "strategy" in the code.
  • Loading branch information...
1 parent 7405991 commit f7b82387c85111a08c53629a3e1b5cb0554a0dcb Kristoffer Ahl committed Apr 1, 2012
@@ -104,7 +104,7 @@ public PolicyResult Enforce(ISecurityContext context)
public class When_setting_the_cache_lifecycle_for_a_policy_on_a_conventionpolicycontainer
{
[Test]
- public void Should_add_policyresult_cache_manifest_to_policycontainers()
+ public void Should_add_policyresult_cache_strategy_to_policycontainers()
{
// Arrange
var controllerName = NameHelper.Controller<AdminController>();
@@ -124,15 +124,15 @@ public void Should_add_policyresult_cache_manifest_to_policycontainers()
// Assert
var containers = policyContainers.Cast<PolicyContainer>().ToList();
- Assert.That(containers[0].CacheManifests.Single().PolicyType, Is.EqualTo(expectedType));
- Assert.That(containers[0].CacheManifests.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
- Assert.That(containers[0].CacheManifests.Single().CacheLevel, Is.EqualTo(By.Controller));
- Assert.That(containers[1].CacheManifests.Single().PolicyType, Is.EqualTo(expectedType));
- Assert.That(containers[1].CacheManifests.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
- Assert.That(containers[1].CacheManifests.Single().CacheLevel, Is.EqualTo(By.Controller));
- Assert.That(containers[2].CacheManifests.Single().PolicyType, Is.EqualTo(expectedType));
- Assert.That(containers[2].CacheManifests.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
- Assert.That(containers[2].CacheManifests.Single().CacheLevel, Is.EqualTo(By.Controller));
+ Assert.That(containers[0].CacheStrategies.Single().PolicyType, Is.EqualTo(expectedType));
+ Assert.That(containers[0].CacheStrategies.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
+ Assert.That(containers[0].CacheStrategies.Single().CacheLevel, Is.EqualTo(By.Controller));
+ Assert.That(containers[1].CacheStrategies.Single().PolicyType, Is.EqualTo(expectedType));
+ Assert.That(containers[1].CacheStrategies.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
+ Assert.That(containers[1].CacheStrategies.Single().CacheLevel, Is.EqualTo(By.Controller));
+ Assert.That(containers[2].CacheStrategies.Single().PolicyType, Is.EqualTo(expectedType));
+ Assert.That(containers[2].CacheStrategies.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
+ Assert.That(containers[2].CacheStrategies.Single().CacheLevel, Is.EqualTo(By.Controller));
}
}
@@ -141,7 +141,7 @@ public void Should_add_policyresult_cache_manifest_to_policycontainers()
public class When_setting_the_cache_lifecycle_and_cache_level_for_a_policy_on_a_conventionpolicycontainer
{
[Test]
- public void Should_add_policyresult_cache_manifest_to_policycontainers()
+ public void Should_add_policyresult_cache_strategy_to_policycontainers()
{
// Arrange
var controllerName = NameHelper.Controller<AdminController>();
@@ -162,15 +162,15 @@ public void Should_add_policyresult_cache_manifest_to_policycontainers()
// Assert
var containers = policyContainers.Cast<PolicyContainer>().ToList();
- Assert.That(containers[0].CacheManifests.Single().PolicyType, Is.EqualTo(expectedType));
- Assert.That(containers[0].CacheManifests.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
- Assert.That(containers[0].CacheManifests.Single().CacheLevel, Is.EqualTo(expectedLevel));
- Assert.That(containers[1].CacheManifests.Single().PolicyType, Is.EqualTo(expectedType));
- Assert.That(containers[1].CacheManifests.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
- Assert.That(containers[1].CacheManifests.Single().CacheLevel, Is.EqualTo(expectedLevel));
- Assert.That(containers[2].CacheManifests.Single().PolicyType, Is.EqualTo(expectedType));
- Assert.That(containers[2].CacheManifests.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
- Assert.That(containers[2].CacheManifests.Single().CacheLevel, Is.EqualTo(expectedLevel));
+ Assert.That(containers[0].CacheStrategies.Single().PolicyType, Is.EqualTo(expectedType));
+ Assert.That(containers[0].CacheStrategies.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
+ Assert.That(containers[0].CacheStrategies.Single().CacheLevel, Is.EqualTo(expectedLevel));
+ Assert.That(containers[1].CacheStrategies.Single().PolicyType, Is.EqualTo(expectedType));
+ Assert.That(containers[1].CacheStrategies.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
+ Assert.That(containers[1].CacheStrategies.Single().CacheLevel, Is.EqualTo(expectedLevel));
+ Assert.That(containers[2].CacheStrategies.Single().PolicyType, Is.EqualTo(expectedType));
+ Assert.That(containers[2].CacheStrategies.Single().CacheLifecycle, Is.EqualTo(expectedLifecycle));
+ Assert.That(containers[2].CacheStrategies.Single().CacheLevel, Is.EqualTo(expectedLevel));
}
}
@@ -197,9 +197,9 @@ public void Should_clear_all_cache_strategies()
// Assert
var containers = policyContainers.Cast<PolicyContainer>().ToList();
- Assert.That(containers[0].CacheManifests.Any(), Is.False);
- Assert.That(containers[1].CacheManifests.Any(), Is.False);
- Assert.That(containers[2].CacheManifests.Any(), Is.False);
+ Assert.That(containers[0].CacheStrategies.Any(), Is.False);
+ Assert.That(containers[1].CacheStrategies.Any(), Is.False);
+ Assert.That(containers[2].CacheStrategies.Any(), Is.False);
}
[Test]
@@ -222,9 +222,9 @@ public void Should_clear_all_cache_strategies_for_policy()
// Assert
var containers = policyContainers.Cast<PolicyContainer>().ToList();
- Assert.That(containers[0].CacheManifests.Single().PolicyType, Is.EqualTo(typeof(RequireAllRolesPolicy)));
- Assert.That(containers[1].CacheManifests.Single().PolicyType, Is.EqualTo(typeof(RequireAllRolesPolicy)));
- Assert.That(containers[2].CacheManifests.Single().PolicyType, Is.EqualTo(typeof(RequireAllRolesPolicy)));
+ Assert.That(containers[0].CacheStrategies.Single().PolicyType, Is.EqualTo(typeof(RequireAllRolesPolicy)));
+ Assert.That(containers[1].CacheStrategies.Single().PolicyType, Is.EqualTo(typeof(RequireAllRolesPolicy)));
+ Assert.That(containers[2].CacheStrategies.Single().PolicyType, Is.EqualTo(typeof(RequireAllRolesPolicy)));
}
}
}
@@ -85,26 +85,26 @@ public void WhenEnforcingPolicyXForControllerXActionX(PolicyType policy, string
public void ThenItShouldCacheResultX(Cache expectedLifecycle)
{
var policyType = ScenarioContext.Current.Get<Type>();
- var manifest = GetPolicyContainer().CacheManifests.SingleOrDefault(x => x.CacheLifecycle == expectedLifecycle && x.PolicyType == policyType);
+ var strategy = GetPolicyContainer().CacheStrategies.SingleOrDefault(x => x.CacheLifecycle == expectedLifecycle && x.PolicyType == policyType);
- Assert.That(manifest, Is.Not.Null);
+ Assert.That(strategy, Is.Not.Null);
}
[Then(@"it should not cache result")]
public void ThenItShouldNotCacheResult()
{
var policyType = ScenarioContext.Current.Get<Type>();
- var manifest = GetPolicyContainer().CacheManifests.SingleOrDefault(x => x.CacheLifecycle == Cache.DoNotCache && x.PolicyType == policyType);
+ var strategy = GetPolicyContainer().CacheStrategies.SingleOrDefault(x => x.CacheLifecycle == Cache.DoNotCache && x.PolicyType == policyType);
- Assert.That(manifest == null || manifest.CacheLifecycle == Cache.DoNotCache, Is.True);
+ Assert.That(strategy == null || strategy.CacheLifecycle == Cache.DoNotCache, Is.True);
}
[Then(@"it should cache result with key ""(.*)_(.*)_(.*)""")]
public void ThenItShouldCacheResultWithKeyX(string controller, string action, string policy)
{
var policyType = ScenarioContext.Current.Get<Type>();
- var manifest = GetPolicyContainer().CacheManifests.SingleOrDefault(x => x.PolicyType == policyType);
- var cacheKey = PolicyResultCacheKeyBuilder.CreateFromManifest(manifest, WriterPolicy, SecurityContext.Current);
+ var strategy = GetPolicyContainer().CacheStrategies.SingleOrDefault(x => x.PolicyType == policyType);
+ var cacheKey = PolicyResultCacheKeyBuilder.CreateFromStrategy(strategy, WriterPolicy, SecurityContext.Current);
VerifyCacheKey(cacheKey, controller, action, policy);
}
Oops, something went wrong.

0 comments on commit f7b8238

Please sign in to comment.