public void Should_be_PolicyResult_BlogController_Post_BlogEditorPolicy_when_custom_cache_key_is_null() { // Arrange var policy = new BlogEditorPolicy(null); var strategy = new PolicyResultCacheStrategy("BlogController", "Post", policy.GetType(), Cache.DoNotCache); var context = TestDataFactory.CreateSecurityContext(true); // Act var cacheKey = PolicyResultCacheKeyBuilder.CreateFromStrategy(strategy, policy, context); // Assert Assert.That(cacheKey, Is.EqualTo("PolicyResult_BlogController_Post_" + NameHelper.Policy <BlogEditorPolicy>())); }
public void Should_be_PolicyResult_BlogController_Post_BlogEditorPolicy_1_when_custom_cache_key_is_1() { // Arrange var policy = new BlogEditorPolicy("1"); var strategy = new PolicyResultCacheStrategy("BlogController", "Post", policy.GetType(), Cache.DoNotCache); var context = TestDataFactory.CreateSecurityContext(true); // Act var cacheKey = PolicyResultCacheKeyBuilder.CreateFromStrategy(strategy, policy, context); // Assert Assert.That(cacheKey, Is.EqualTo("PolicyResult_BlogController_Post_" + NameHelper.Policy<BlogEditorPolicy>() + "_1")); }