public void DeleteCompositePageTests(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 NullArgumentExceptionTest() { //Act var dataEventHandler = new DataEventProcessor(fakeApplicationLogger, fakeCompositePageBuilder, fakeAsyncHelper, fakeDataEventActions, fakeDynamicContentConverter, fakeServiceBusMessageProcessor, fakeDynamicContentExtensions, fakeDynamicContentAction, fakeSitefinityManagerProxy); //Asserts Assert.Throws <ArgumentNullException>(() => dataEventHandler.ExportCompositePage(null)); }
public void ExportCompositePageExceptionTest() { //Setup A.CallTo(() => fakeApplicationLogger.ErrorJustLogIt(A <string> ._, A <Exception> ._)).DoesNothing(); A.CallTo(() => fakeDataEventActions.GetEventAction(A <IDataEvent> ._)).Throws(new ArgumentException()); //Act var dataEventHandler = new DataEventProcessor(fakeApplicationLogger, fakeCompositePageBuilder, fakeAsyncHelper, fakeDataEventActions, fakeDynamicContentConverter, fakeServiceBusMessageProcessor, fakeDynamicContentExtensions, fakeDynamicContentAction, fakeSitefinityManagerProxy); //Asserts Assert.Throws <ArgumentException>(() => dataEventHandler.ExportCompositePage(fakeDataEvent)); A.CallTo(() => fakeApplicationLogger.ErrorJustLogIt(A <string> ._, A <Exception> ._)).MustHaveHappenedOnceExactly(); }