public async Task WhenIGetTheContentSummariesForSlugWithLimitAndContinuationTokenAndCallIt(string slug, int limit, string continuationToken, string contentSummariesName)
        {
            IContentStore    store     = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);
            ContentSummaries summaries = await store.GetContentSummariesAsync(SpecHelpers.ParseSpecValue <string>(this.scenarioContext, slug), limit, SpecHelpers.ParseSpecValue <string>(this.scenarioContext, continuationToken)).ConfigureAwait(false);

            this.scenarioContext.Set(summaries, contentSummariesName);
        }
 public async Task GivenIDraftTheContentWithSlug(string slug)
 {
     IContentStore store = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);
     await store.MakeDraftContentAsync(
         SpecHelpers.ParseSpecValue <string>(this.scenarioContext, slug),
         new CmsIdentity("SomeId", "SomeName")).ConfigureAwait(false);
 }
        public async Task WhenIGetTheContentPublicationStateForSlugAndCallItAsync(string slug, string contentName)
        {
            IContentStore store   = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);
            ContentState  content = await store.GetContentPublicationStateAsync(SpecHelpers.ParseSpecValue <string>(this.scenarioContext, slug)).ConfigureAwait(false);

            this.scenarioContext.Set(content, contentName);
        }
        public void ThenGettingThePublishedContentForSlugThrowsAContentNotFoundException(string slug)
        {
            IContentStore store = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);

            Assert.ThrowsAsync <ContentNotFoundException>(
                () => store.GetPublishedContentAsync(SpecHelpers.ParseSpecValue <string>(this.scenarioContext, slug)),
                "ContentNotFoundException should have been thrown.");
        }
        public async Task WhenIGetTheContentForTheContentStateCalledAndCallItAsync(string stateName, string contentName)
        {
            ContentState  state   = this.scenarioContext.Get <ContentState>(stateName);
            IContentStore store   = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);
            Content       content = await store.GetContentAsync(state.ContentId, state.Slug).ConfigureAwait(false);

            this.scenarioContext.Set(content, contentName);
        }
        public async Task WhenICopyTheContentFromSlugToAndCallIt(string sourceSlug, string destinationSlug, string copyName)
        {
            IContentStore store  = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);
            Content       result = await store.CopyContentForPublicationAsync(
                SpecHelpers.ParseSpecValue <string>(this.scenarioContext, destinationSlug),
                SpecHelpers.ParseSpecValue <string>(this.scenarioContext, sourceSlug),
                new CmsIdentity("SomeId", "SomeName")).ConfigureAwait(false);

            this.scenarioContext.Set(result, copyName);
        }
        public async Task WhenIGetThePublishedStateHistoryAndCorrespondingContentSummariesForSlugAndCallIt(string slug, int limit, string continuationToken, string name)
        {
            IContentStore store  = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);
            ContentStates states = await store.GetPublishedHistory(
                SpecHelpers.ParseSpecValue <string>(this.scenarioContext, slug),
                limit,
                SpecHelpers.ParseSpecValue <string>(this.scenarioContext, continuationToken)).ConfigureAwait(false);

            List <ContentSummary> summaries = await store.GetContentSummariesForStatesAsync(states.States).ConfigureAwait(false);

            this.scenarioContext.Set((states, summaries), name);
        }
        public async Task GivenIHaveCreatedContentWithAnAbTestSet(Table contentTable)
        {
            IContentStore store = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);

            foreach (TableRow row in contentTable.Rows)
            {
                (Content content, string name) = ContentSpecHelpers.GetContentFor(row);
                ContentSpecHelpers.SetAbTestSet(this.scenarioContext, content, row);
                await store.StoreContentAsync(content).ConfigureAwait(false);

                this.scenarioContext.Set(content, name);
            }
        }
        public async Task WhenIGetThePublicationHistoryForSlugWithLimitAndContinuationTokenAndCallItAsync(string slug, int limit, string continuationTokenSource, string contentSummariesName)
        {
            IContentStore store = ContentManagementCosmosContainerBindings.GetContentStore(this.featureContext);

            string continuationToken = continuationTokenSource == null
                ? null
                : this.scenarioContext.Get <(ContentStates States, List <ContentSummary> Summaries)>(continuationTokenSource).States.ContinuationToken;

            ContentStates states = await store.GetPublicationHistory(
                SpecHelpers.ParseSpecValue <string>(this.scenarioContext, slug),
                limit,
                continuationToken).ConfigureAwait(false);

            List <ContentSummary> summaries = await store.GetContentSummariesForStatesAsync(states.States).ConfigureAwait(false);

            this.scenarioContext.Set((states, summaries), contentSummariesName);
        }