Save() public method

Saves the specified content.
public Save ( ContentModel content ) : void
content ContentModel The content - requires host, path, and name property.
return void
        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 TestListRootPathReturnsTwoItem()
        {
            // Arrange
            var repo =
                new SqlContentRepository(new SqlDataRepository(), "DefaultDatabase", "CmsContent", string.Empty);
            var model = new ContentModel() { Host = "localhost", Path = "/" };

            // Act
            repo.Save(
                    new ContentModel()
                    {
                        Host = "localhost",
                        Path = "/test/foo/article",
                        Data = System.Text.Encoding.UTF8.GetBytes("test"),
                        CreateBy = string.Empty
                    });
            var result = repo.List(model);

            // Assert
            Assert.AreEqual(2, result.Count());
        }
        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));
        }