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_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);
        }
        public async Task Update_PreviewSyncToGraphReplicaSetThrows_ExceptionPropagates()
        {
            A.CallTo(() => PublishedAllowSync.Result)
            .Returns(AllowSyncResult.Allowed);

            A.CallTo(() => PreviewAllowSync.Result)
            .Returns(AllowSyncResult.Allowed);

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

            await Assert.ThrowsAsync <Exception>(() => SyncOrchestrator.Update(ContentItem, ContentItem));
        }
        public async Task Update_SyncToGraphReplicaSetOnPreviewGraphCalled(
            AllowSyncResult publishedAllowSyncResult,
            AllowSyncResult previewAllowSyncResult,
            int publishedCalled)
        {
            A.CallTo(() => PublishedAllowSync.Result)
            .Returns(publishedAllowSyncResult);

            A.CallTo(() => PreviewAllowSync.Result)
            .Returns(previewAllowSyncResult);

            await SyncOrchestrator.Update(ContentItem, ContentItem);

            A.CallTo(() => PreviewMergeGraphSyncer.SyncToGraphReplicaSet())
            .MustHaveHappened(publishedCalled, Times.Exactly);
        }