예제 #1
0
        public void Returns_EmptyTemplateCacheResult_OnNonExistingTemplate()
        {
            var cache = new MemoryCachingProvider();

            var templateResult = cache.RetrieveTemplate("someKey");

            Assert.NotNull(templateResult);
            Assert.Null(templateResult.Template.TemplatePageFactory);
            Assert.False(templateResult.Success);
        }
예제 #2
0
        public void Ensure_TemplateIsStored()
        {
            var cache = new MemoryCachingProvider();

            string templateKey = "key";
            var    factory     = GetTestFactory(templateKey);

            cache.CacheTemplate(templateKey, factory);

            var cachedFactory = cache.RetrieveTemplate(templateKey);

            Assert.Equal(factory, cachedFactory.Template.TemplatePageFactory);
        }
예제 #3
0
        public void Throws_OnNullTemplateKey_WhenRetrieve()
        {
            var cache = new MemoryCachingProvider();

            Assert.Throws <ArgumentNullException>(() => cache.RetrieveTemplate(null));
        }