public void ExportCompositePageTests(bool isContentPage, MicroServicesDataEventAction microServicesDataEventAction) { //Setup A.CallTo(() => fakeDataEventActions.GetEventAction(A <IDataEvent> ._)).Returns(microServicesDataEventAction); if (isContentPage) { A.CallTo(() => fakeCompositePageBuilder.GetContentPageTypeFromPageNode(A <Type> ._, A <Guid> ._, A <string> ._)).Returns(true); } else { A.CallTo(() => fakeCompositePageBuilder.GetContentPageTypeFromPageNode(A <Type> ._, A <Guid> ._, A <string> ._)).Returns(false); } //Act var dataEventHandler = new DataEventProcessor(fakeApplicationLogger, fakeCompositePageBuilder, fakeAsyncHelper, fakeDataEventActions, fakeDynamicContentConverter, fakeServiceBusMessageProcessor, fakeDynamicContentExtensions, fakeDynamicContentAction, fakeSitefinityManagerProxy); dataEventHandler.ExportCompositePage(fakeDataEvent); //Asserts if (isContentPage) { A.CallTo(() => fakeServiceBusMessageProcessor.SendContentPageMessage(A <MicroServicesPublishingPageData> ._, A <string> ._, A <string> ._)).MustHaveHappenedOnceExactly(); } else { A.CallTo(() => fakeServiceBusMessageProcessor.SendContentPageMessage(A <MicroServicesPublishingPageData> ._, A <string> ._, A <string> ._)).MustNotHaveHappened(); } }
public void ExportCompositePage(IDataEvent eventInfo) { if (eventInfo == null) { throw new ArgumentNullException("eventInfo"); } try { var microServicesDataEventAction = dataEventActions.GetEventAction(eventInfo); var itemId = eventInfo.ItemId; var providerName = eventInfo.ProviderName; var contentType = eventInfo.ItemType; var isContentPage = compositePageBuilder.GetContentPageTypeFromPageNode(contentType, itemId, providerName); if (isContentPage && microServicesDataEventAction == MicroServicesDataEventAction.PublishedOrUpdated) { ExportPageNode(providerName, contentType, itemId, Constants.WorkflowStatusPublished); } else if (isContentPage && microServicesDataEventAction == MicroServicesDataEventAction.UnpublishedOrDeleted) { ExportPageNode(providerName, contentType, itemId, Constants.ItemActionDeleted); } } catch (Exception ex) { applicationLogger.ErrorJustLogIt($"Failed to export page data for item id {eventInfo.ItemId}", ex); throw; } }