public Retrieve ( |
||
content | The content - requires host, path, and name property. | |
includeData | bool | if set to |
return |
public static void MyTestInitialize(TestContext testContext) { // Arrange Bootstrapper.Default.Config = ConfigurationManager.GetSection("phuncms") as ICmsConfiguration; var repo = new SqlContentRepository(new SqlDataRepository(), "DefaultDatabase", "CmsContent", string.Empty); var fileRepo = new FileContentRepository(System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "CmsContent")); // Act var result = fileRepo.Retrieve(new ContentModel() { Host = "localhost", Path = "/ArticleTitle" }, true); repo.Save(result); result = fileRepo.Retrieve(new ContentModel() { Host = "localhost", Path = "/test/test/article" }, true); repo.Save(result); result = fileRepo.Retrieve(new ContentModel() { Host = "localhost", Path = "/test/test/article-title" }, true); repo.Save(result); }
public void TestRetrieveGetContentFromFile() { // Arrange var repo = new FileContentRepository(System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "CmsContent")); // Act var result = repo.Retrieve(new ContentModel() { Host = "localhost", Path = "/ArticleTitle" }, true); // Assert Assert.IsNotNull(result.Data); Assert.IsTrue(result.DataLength > 0); }
public void TestSaveNewContentToFile() { // Arrange var repo = new FileContentRepository(System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "CmsContent")); // 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.SetDataFromStream().Data); Assert.IsNotNull(result2.SetDataFromStream().Data); Assert.AreNotEqual(result.Data, result2.Data); }