public void ContentFor_WhenContentItemExists_RetrievesItem()
        {
            var contentItem = new CmsContentItem(ItemName) {Content = ItemValue};
            _contentRepository.Add(ItemName, contentItem);

            var item = _contentService.ContentFor(ItemName);

            Assert.That(item, Is.EqualTo(ItemValue));
        }
 public void SaveOrUpdate(CmsContentItem item)
 {
     throw new NotImplementedException();
 }
 public virtual CmsContentItem OnSave(CmsContentItem rawItem)
 {
     return rawItem;
 }
        public void ContentFor_WhenContentItemExists_RetrievesFromInternalCache()
        {
            var contentItem = new CmsContentItem(ItemName) {Content = ItemValue};
            _contentRepository.Add(ItemName, contentItem);

            _contentService.ContentFor(ItemName);

            Assert.That(_contentRepository.RetrieveAllCalled, Is.True);
            Assert.That(_contentRepository.RetrieveCalled, Is.False);
        }
 public virtual CmsContentItem OnRetrieve(CmsContentItem rawItem)
 {
     return rawItem;
 }
 public void SaveOrUpdate(CmsContentItem item)
 {
     _realContentRepository().SaveOrUpdate(item);
     UpdateCache();
 }
Exemplo n.º 7
0
        public CmsContentItem SaveContentFor(string contentItemName, string contentValue)
        {
            var localisedContentItemName = LocaliseContentItemName(contentItemName);

            var contentItem = new CmsContentItem(localisedContentItemName) { Content = contentValue };
            contentItem = ApplyOnSaveFilters(contentItem);

            var repo = _repoProxy();
            repo.SaveOrUpdate(contentItem);

            return contentItem;
        }
Exemplo n.º 8
0
 private CmsContentItem ApplyOnSaveFilters(CmsContentItem contentItem)
 {
     contentItem = ContentRegistration.ContentPipelineFilters.Aggregate(contentItem, (current, filter) => filter.OnSave(current));
     return contentItem;
 }
Exemplo n.º 9
0
 private CmsContentItem ApplyOnRetrieveFilters(CmsContentItem contentItem)
 {
     return ContentRegistration.ContentPipelineFilters.Aggregate(contentItem, (current, filter) => filter.OnRetrieve(current));
 }