public void FixtureSetUp() { this.DeleteAllCategories(); using (new ElevatedModeRegion(TaxonomyManager.GetManager())) { var taxonomyOperations = new TaxonomiesOperations(); foreach (var taxon in this.taxaNamesWithParents) { string parentName; string taxonName; this.GetTaxonNameAndParentName(taxon, out parentName, out taxonName); taxonomyOperations.CreateHierarchicalTaxon(taxonName, parentName, "Categories"); } var newsOperations = new NewsOperations(); var newsItemId = Guid.NewGuid(); newsOperations.CreateNewsItem("n1", newsItemId); taxonomyOperations.AddTaxonsToNews(newsItemId, new string[] { "c3", "c3c2c1" }, new string[0]); var newsManager = NewsManager.GetManager(); // The item have to be published again after a taxon is asigned in order to update the taxonomy statistics. var newsItem = newsManager.GetNewsItem(newsItemId); newsItem.SetWorkflowStatus(newsManager.Provider.ApplicationName, "Published"); newsManager.SaveChanges(); newsManager.Lifecycle.Publish(newsItem); newsManager.SaveChanges(); } }
public void SetUp() { ServerOperations.Taxonomies().CreateTag(ContentModelBaseTests.TagName); var taxonomyOperations = new TaxonomiesOperations(); Guid newsItemId = Guid.Empty; var newsManager = NewsManager.GetManager(); for (var i = 0; i < 10; i++) { var title = "news" + i.ToString(CultureInfo.InvariantCulture); newsItemId = Guid.NewGuid(); ServerOperations.News().CreateNewsItem(title, newsItemId); taxonomyOperations.AddTaxonsToNews(newsItemId, new string[0], new string[] { ContentModelBaseTests.TagName }); // The item have to be published again after a taxon is asigned in order to update the taxonomy statistics. var newsItem = newsManager.GetNewsItem(newsItemId); newsItem.SetWorkflowStatus(newsManager.Provider.ApplicationName, "Published"); newsManager.SaveChanges(); newsManager.Lifecycle.Publish(newsItem); } newsManager.SaveChanges(); }
public void FixtureSetUp() { using (new ElevatedModeRegion(TaxonomyManager.GetManager())) { var taxonomyOperations = new TaxonomiesOperations(); foreach (var taxon in this.taxaNamesWithParents) { string parentName; string taxonName; this.GetTaxonNameAndParentName(taxon, out parentName, out taxonName); taxonomyOperations.CreateHierarchicalTaxon(taxonName, parentName, "Categories"); } var newsOperations = new NewsOperations(); var newsItemId = Guid.NewGuid(); newsOperations.CreateNewsItem("n1", newsItemId); taxonomyOperations.AddTaxonsToNews(newsItemId, new string[] { "c3", "c3c2c1" }, new string[0]); var newsManager = NewsManager.GetManager(); // The item have to be published again after a taxon is asigned in order to update the taxonomy statistics. var newsItem = newsManager.GetNewsItem(newsItemId); newsItem.SetWorkflowStatus(newsManager.Provider.ApplicationName, "Published"); newsManager.SaveChanges(); newsManager.Lifecycle.Publish(newsItem); newsManager.SaveChanges(); } }