Retrieve() public méthode

Populate or gets the content provided specific host, path, and name property.
public Retrieve ( ContentModel content, bool includeData = true ) : ContentModel
content ContentModel The content - requires host, path, and name property.
includeData bool if set to true [include data].
Résultat ContentModel
        public void TestSaveNewContent()
        {
            // Arrange
            var repo =
                new SqlContentRepository(new SqlDataRepository(), "DefaultDatabase", "CmsContent", string.Empty);

            // Act
            var result = repo.Retrieve(new ContentModel() { Host = "localhost", Path = "/test/test/article-title" });
            repo.Save(
                    new ContentModel()
                    {
                        Host = "localhost",
                        Path = "/test/test/article-title",
                        Data = System.Text.Encoding.UTF8.GetBytes("test")
                    });

            var result2 = repo.Retrieve(new ContentModel() { Host = "localhost", Path = "/test/test/article-title" });

            // Assert
            Assert.IsNotNull(result.Data);
            Assert.IsNotNull(result2.Data);

            Assert.AreNotEqual(System.Text.Encoding.UTF8.GetString(result.Data), System.Text.Encoding.UTF8.GetString(result2.Data));
        }
        public void TestRetrieveGetContent()
        {
            // Arrange
            var repo =
                new SqlContentRepository(new SqlDataRepository(), "DefaultDatabase", "CmsContent", string.Empty);

            // Act
            var result = repo.Retrieve(new ContentModel() { Host = "localhost", Path = "/ArticleTitle" }, true);

            // Assert
            Assert.IsNotNull(result.Data);
            Assert.IsTrue(result.DataLength > 0);
        }