Ejemplo n.º 1
0
        public void DefaultContenExistTwoFoundTest()
        {
            IContentStore contentStore = manager.GetContentStore(repositoryId);

            contentStore.Items.Add(new StringContentItem()
            {
                Id           = Guid.NewGuid(),
                DefinitionId = definitionId,
                Data         = "First"
            });
            contentStore.Items.Add(new StringContentItem()
            {
                Id           = Guid.NewGuid(),
                DefinitionId = definitionId,
                Data         = "Second"
            });
            contentStore.Save();

            // check GetContentString
            ContentEngine engine = new ContentEngine(repositoryName);

            Assert.AreEqual("First", engine.GetContentString(contentName));

            // check GetContentStrings
            var list = engine.GetContentStrings(contentName).ToList();

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual("First", list[0]);
            Assert.AreEqual("Second", list[1]);
        }
Ejemplo n.º 2
0
        public static IHtmlContent GetCmsString(this IHtmlHelper htmlHelper, string repositoryName, string contentName)
        {
            ContentEngine engine = new ContentEngine(repositoryName);

            return(new HtmlString(
                       engine.GetContentString(contentName)
                       ));
        }
Ejemplo n.º 3
0
        public void DefaultContentExistTwoFoundTest()
        {
            IContentStore contentStore = manager.GetContentStore(repositoryId);
            var           contentItem  = new StringContentItem()
            {
                Id           = Guid.NewGuid(),
                DefinitionId = definitionId,
                Data         = "UniqueValue"
            };

            contentStore.Items.Add(contentItem);
            contentStore.Save();

            ContentEngine engine = new ContentEngine(repositoryName);

            Assert.AreEqual("UniqueValue", engine.GetContentString(contentName));
            Assert.AreEqual(1, engine.GetContentStrings(contentName).Count());
        }
Ejemplo n.º 4
0
        public void DefaultContentNotFoundTest()
        {
            ContentEngine engine = new ContentEngine(repositoryName);

            Assert.AreEqual("", engine.GetContentString(contentName));
        }