public Task Restore_PublishedDeleteThrows_ExceptionPropagates() { A.CallTo(() => PublishedAllowSync.Result) .Returns(AllowSyncResult.Allowed); A.CallTo(() => PreviewAllowSync.Result) .Returns(AllowSyncResult.Allowed); A.CallTo(() => PublishedDeleteGraphSyncer.Delete()) .Throws(() => new Exception()); return(Assert.ThrowsAsync <Exception>(() => SyncOrchestrator.Restore(ContentItem))); }
public async Task Restore_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.Restore(ContentItem)); }
public async Task Restore_SyncAllowedSyncMatrix_ReturnsBool( AllowSyncResult publishedAllowSyncAllowedResult, AllowSyncResult previewAllowSyncAllowedResult, bool expectedSuccess) { A.CallTo(() => PublishedAllowSync.Result) .Returns(publishedAllowSyncAllowedResult); A.CallTo(() => PreviewAllowSync.Result) .Returns(previewAllowSyncAllowedResult); bool success = await SyncOrchestrator.Restore(ContentItem); Assert.Equal(expectedSuccess, success); }
public async Task Restore_SyncToGraphReplicaSetCalled( AllowSyncResult publishedAllowSyncResult, AllowSyncResult previewAllowSyncResult, int publishedCalled) { A.CallTo(() => PublishedAllowSync.Result) .Returns(publishedAllowSyncResult); A.CallTo(() => PreviewAllowSync.Result) .Returns(previewAllowSyncResult); await SyncOrchestrator.Restore(ContentItem); A.CallTo(() => PreviewMergeGraphSyncer.SyncToGraphReplicaSet()) .MustHaveHappened(publishedCalled, Times.Exactly); }
public async Task Restore_EventGridPublishingHandlerCalled( AllowSyncResult publishedAllowSyncResult, AllowSyncResult previewAllowSyncResult, int publishedCalled) { A.CallTo(() => PublishedAllowSync.Result) .Returns(publishedAllowSyncResult); A.CallTo(() => PreviewAllowSync.Result) .Returns(previewAllowSyncResult); await SyncOrchestrator.Restore(ContentItem); A.CallTo(() => EventGridPublishingHandler.Restored( A <IOrchestrationContext> .That.Matches(ctx => Equals(ctx.ContentItem, ContentItem)))) .MustHaveHappened(publishedCalled, Times.Exactly); }