public async Task SaveDraft_MergeGraphSyncerThrows_ExceptionPropagates()
        {
            A.CallTo(() => PreviewAllowSync.Result)
            .Returns(AllowSyncResult.Allowed);

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

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

            await SyncOrchestrator.SaveDraft(ContentItem);

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

            bool success = await SyncOrchestrator.SaveDraft(ContentItem);

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

            await SyncOrchestrator.SaveDraft(ContentItem);

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