Example #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);
        }
Example #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);
        }
Example #3
0
        public void Throws_OnNullTemplateKey_WhenRetrieve()
        {
            var cache = new MemoryCachingProvider();

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