예제 #1
0
        public void Insert_Delete_Category()
        {
            TextContent news1 = new TextContent(repository.Name, newsSchema.Name, textFolder.FullName);

            news1["Title"] = "title1";
            news1["body"]  = "body1";
            provider.Add(news1);

            TextContent category1 = new TextContent(repository.Name, "category", "category");

            category1["Title"] = "category1";
            provider.Add(category1);

            var categories = new Category[] { new Category()
                                              {
                                                  ContentUUID = news1.UUID, CategoryFolder = category1.FolderName, CategoryUUID = category1.UUID
                                              } };

            provider.AddCategories(news1, categories);
            provider.DeleteCategories(news1, categories);
            provider.AddCategories(news1, categories);
            provider.ClearCategories(news1);

            provider.ClearCategories(news1);
        }
예제 #2
0
        public virtual void RemoveCategories(Repository repository, TextContent textContent, params TextContent[] categories)
        {
            var relations = categories.Select(it => new Category()
            {
                ContentUUID    = textContent.UUID,
                CategoryFolder = it.FolderName,
                CategoryUUID   = it.UUID
            });

            TextContentProvider.DeleteCategories(textContent, relations.ToArray());
        }
예제 #3
0
 public void Test_AddCategories()
 {
     provider.Add(news1);
     provider.Add(category1);
     provider.AddCategories(news1, categories);
     provider.ClearCategories(news1);
     provider.AddCategories(news1, categories);
     provider.DeleteCategories(news1, categories);
     provider.Delete(news1);
     provider.Delete(category1);
 }
예제 #4
0
        public void TestAddCategory()
        {
            dynamic category1 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.Name)
            {
                UserKey = "category1"
            };

            category1.Title = "category1";

            textContentProvider.Add(category1);

            dynamic category2 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.Name)
            {
                UserKey = "category2"
            };

            category2.Title = "category2";

            textContentProvider.Add(category2);

            dynamic news1 = new TextContent(repository.Name, newsSchema.Name, newsFolder.Name)
            {
                UserKey = "news1"
            };

            news1.title = "news1";
            textContentProvider.Add(news1);

            textContentProvider.AddCategories(news1, new Category()
            {
                ContentUUID = news1.uuid, CategoryFolder = categoryFolder.FullName, CategoryUUID = (string)(category1.UUID)
            },
                                              new Category()
            {
                ContentUUID = news1.uuid, CategoryFolder = categoryFolder.FullName, CategoryUUID = (string)(category2.UUID)
            });

            textContentProvider.DeleteCategories(news1, new Category()
            {
                ContentUUID = news1.uuid, CategoryFolder = categoryFolder.FullName, CategoryUUID = (string)(category2.UUID)
            });
        }