/// <summary> /// Initializes a new instance of the <see cref="WorkflowStateService"/> class. /// </summary> /// <param name="contentStoreFactory">The content store for the service.</param> /// <param name="contentStateMapper">The mapper for <see cref="ContentState"/> results.</param> public WorkflowStateService( ITenantedContentStoreFactory contentStoreFactory, ContentStateResponseMapper contentStateMapper) { this.contentStoreFactory = contentStoreFactory; this.contentStateMapper = contentStateMapper; }
/// <summary> /// Initializes a new instance of the <see cref="ContentService"/> class. /// </summary> /// <param name="contentStoreFactory">The content store for the service.</param> /// <param name="contentSummaryMapper">The mapper for <see cref="ContentSummary"/> responses.</param> public ContentSummaryService( ITenantedContentStoreFactory contentStoreFactory, ContentSummaryResponseMapper contentSummaryMapper) { this.contentStoreFactory = contentStoreFactory; this.contentSummaryMapper = contentSummaryMapper; }
public static async Task CreateContentStateTestData(FeatureContext featureContext) { ITenantedContentStoreFactory contentStoreFactory = ContainerBindings.GetServiceProvider(featureContext).GetRequiredService <ITenantedContentStoreFactory>(); IContentStore store = await contentStoreFactory.GetContentStoreForTenantAsync(featureContext.GetCurrentTenantId()).ConfigureAwait(false); for (int i = 0; i < 30; i++) { var state = new ContentState { Id = Guid.NewGuid().ToString(), ContentId = SpecHelpers.ParseSpecValue <string>(featureContext, $"{{Content{i}.Id}}"), Slug = SpecHelpers.ParseSpecValue <string>(featureContext, $"{{Content{i}.Slug}}"), WorkflowId = "workflow1id", ChangedBy = new CmsIdentity(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()), }; if (i < 4) { state.StateName = "draft"; } else if (i < 29) { state.StateName = "published"; } else { state.StateName = "archived"; } ContentState storedContentState = await store.SetContentWorkflowStateAsync(state.Slug, state.ContentId, state.WorkflowId, state.StateName, state.ChangedBy).ConfigureAwait(false); featureContext.Set(storedContentState, $"Content{i}-State"); } }
public static async Task CreateContentTestData(FeatureContext featureContext) { ITenantedContentStoreFactory contentStoreFactory = ContainerBindings.GetServiceProvider(featureContext).GetRequiredService <ITenantedContentStoreFactory>(); IContentStore store = await contentStoreFactory.GetContentStoreForTenantAsync(featureContext.GetCurrentTenantId()).ConfigureAwait(false); for (int i = 0; i < 30; i++) { var content = new Content { Id = Guid.NewGuid().ToString(), Slug = "slug", Tags = new List <string> { "First tag", "Second tag" }, CategoryPaths = new List <string> { "/standard/content;", "/books/hobbit;", "/books/lotr" }, Author = new CmsIdentity(Guid.NewGuid().ToString(), "Bilbo Baggins"), Title = "This is the title", Description = "A description of the content", Culture = CultureInfo.GetCultureInfo("en-GB"), }; Content storedContent = await store.StoreContentAsync(content).ConfigureAwait(false); featureContext.Set(storedContent, "Content" + i); } }
public async Task GivenAContentItemHasBeenCreated(Table table) { ITenantedContentStoreFactory contentStoreFactory = ContainerBindings.GetServiceProvider(this.featureContext).GetRequiredService <ITenantedContentStoreFactory>(); IContentStore store = await contentStoreFactory.GetContentStoreForTenantAsync(this.featureContext.GetCurrentTenantId()).ConfigureAwait(false); foreach (TableRow row in table.Rows) { (Cms.Content content, string name) = ContentSpecHelpers.GetContentFor(row); Cms.Content storedContent = await store.StoreContentAsync(content).ConfigureAwait(false); this.scenarioContext.Set(storedContent, name); } }
public async Task GivenAWorkflowStateHasBeenSetForTheContentItem(Table table) { ITenantedContentStoreFactory contentStoreFactory = ContainerBindings.GetServiceProvider(this.featureContext).GetRequiredService <ITenantedContentStoreFactory>(); IContentStore store = await contentStoreFactory.GetContentStoreForTenantAsync(this.featureContext.GetCurrentTenantId()).ConfigureAwait(false); foreach (TableRow row in table.Rows) { (Cms.ContentState state, string name) = ContentSpecHelpers.GetContentStateFor(row); // Cater for the fact that the content item could be in either of scenario or feature context. state.ContentId = SpecHelpers.ParseSpecValue <string>(this.scenarioContext, state.ContentId); state.ContentId = SpecHelpers.ParseSpecValue <string>(this.featureContext, state.ContentId); Cms.ContentState storedContentState = await store.SetContentWorkflowStateAsync(state.Slug, state.ContentId, state.WorkflowId, state.StateName, state.ChangedBy).ConfigureAwait(false); this.scenarioContext.Set(storedContentState, name); } }