public async Task Clone_CloneGraphSyncsMutateOnCloneCalled()
        {
            await SyncOrchestrator.Clone(ContentItem);

            A.CallTo(() => CloneGraphSync.MutateOnClone(ContentItem, ContentManager, null))
            .MustHaveHappened();
        }
        public Task Clone_MergeGraphSyncerThrows_ExceptionPropagates()
        {
            A.CallTo(() => PreviewAllowSync.Result)
            .Returns(AllowSyncResult.Allowed);

            A.CallTo(() => PreviewMergeGraphSyncer.SyncToGraphReplicaSet())
            .Throws(() => new Exception());

            return(Assert.ThrowsAsync <Exception>(() => SyncOrchestrator.Clone(ContentItem)));
        }
        public async Task Clone_EventGridPublishingHandlerCalled(AllowSyncResult previewAllowSyncResult, int draftSavedCalled)
        {
            A.CallTo(() => PreviewAllowSync.Result)
            .Returns(previewAllowSyncResult);

            await SyncOrchestrator.Clone(ContentItem);

            A.CallTo(() => EventGridPublishingHandler.Cloned(
                         A <IOrchestrationContext> .That.Matches(ctx => Equals(ctx.ContentItem, ContentItem))))
            .MustHaveHappened(draftSavedCalled, Times.Exactly);
        }
        public async Task Clone_SyncAllowedMatrix_ReturnsBool(
            AllowSyncResult allowSyncAllowedResult,
            bool expectedSuccess)
        {
            A.CallTo(() => PreviewAllowSync.Result)
            .Returns(allowSyncAllowedResult);

            bool success = await SyncOrchestrator.Clone(ContentItem);

            Assert.Equal(expectedSuccess, success);
        }
        public async Task Clone_SyncAllowedMatrix_SyncCalled(
            AllowSyncResult allowSyncAllowedResult,
            bool expectedSyncCalled)
        {
            A.CallTo(() => PreviewAllowSync.Result)
            .Returns(allowSyncAllowedResult);

            await SyncOrchestrator.Clone(ContentItem);

            A.CallTo(() => PreviewMergeGraphSyncer.SyncToGraphReplicaSet())
            .MustHaveHappened(expectedSyncCalled?1:0, Times.Exactly);
        }